

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Python Library Reference &mdash; MCC DAQ HAT Library 1.2.0 documentation</title>
  

  
  
    <link rel="shortcut icon" href="_static/favicon.ico"/>
  
  
  

  

  
  
    

  

  
    <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="_static/theme_overrides.css" type="text/css" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="prev" title="C Library Reference" href="c.html" /> 

  
  <script src="_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="index.html" class="icon icon-home"> MCC DAQ HAT Library
          

          
          </a>

          
            
            
              <div class="version">
                1.2.0
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="overview.html">Hardware Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="hardware.html">Installing the DAQ HAT board</a></li>
<li class="toctree-l1"><a class="reference internal" href="install.html">Installing and Using the Library</a></li>
<li class="toctree-l1"><a class="reference internal" href="c.html">C Library Reference</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Python Library Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#global-methods-and-data">Global methods and data</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#methods">Methods</a></li>
<li class="toctree-l3"><a class="reference internal" href="#data">Data</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#hat-ids">Hat IDs</a></li>
<li class="toctree-l4"><a class="reference internal" href="#trigger-modes">Trigger modes</a></li>
<li class="toctree-l4"><a class="reference internal" href="#scan-read-option-flags">Scan / read option flags</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#haterror-class">HatError class</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#mcc-118-class">MCC 118 class</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id1">Methods</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#mcc-134-class">MCC 134 class</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id2">Methods</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id3">Data</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#thermocouple-types">Thermocouple types</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#mcc-152-class">MCC 152 class</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id4">Methods</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id5">Data</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#dio-config-items">DIO Config Items</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">MCC DAQ HAT Library</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html">Docs</a> &raquo;</li>
        
      <li>Python Library Reference</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/python.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="python-library-reference">
<h1>Python Library Reference<a class="headerlink" href="#python-library-reference" title="Permalink to this headline">¶</a></h1>
<p>The Python library is organized as a global method for listing the DAQ HAT boards attached
to your system, and board-specific classes to provide full functionality for each type
of board.  The Python package is named <em>daqhats</em>.</p>
<div class="section" id="global-methods-and-data">
<h2>Global methods and data<a class="headerlink" href="#global-methods-and-data" title="Permalink to this headline">¶</a></h2>
<div class="section" id="methods">
<h3>Methods<a class="headerlink" href="#methods" title="Permalink to this headline">¶</a></h3>
<table border="1" class="docutils">
<colgroup>
<col width="45%" />
<col width="55%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td>Method</td>
<td>Description</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.hat_list" title="daqhats.hat_list"><code class="xref py py-func docutils literal notranslate"><span class="pre">hat_list()</span></code></a></td>
<td>Return a list of detected DAQ HAT boards.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.interrupt_state" title="daqhats.interrupt_state"><code class="xref py py-func docutils literal notranslate"><span class="pre">interrupt_state()</span></code></a></td>
<td>Read the current DAQ HAT interrupt status.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.wait_for_interrupt" title="daqhats.wait_for_interrupt"><code class="xref py py-func docutils literal notranslate"><span class="pre">wait_for_interrupt()</span></code></a></td>
<td>Wait for a DAQ HAT  interrupt to occur.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.interrupt_callback_enable" title="daqhats.interrupt_callback_enable"><code class="xref py py-func docutils literal notranslate"><span class="pre">interrupt_callback_enable()</span></code></a></td>
<td>Enable an interrupt callback function.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.interrupt_callback_disable" title="daqhats.interrupt_callback_disable"><code class="xref py py-func docutils literal notranslate"><span class="pre">interrupt_callback_disable()</span></code></a></td>
<td>Disable interrupt callback function.</td>
</tr>
</tbody>
</table>
<dl class="function">
<dt id="daqhats.hat_list">
<code class="descclassname">daqhats.</code><code class="descname">hat_list</code><span class="sig-paren">(</span><em>filter_by_id=0</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.hat_list" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of detected DAQ HAT boards.</p>
<p>Scans certain locations for information from the HAT EEPROMs.  Verifies the
contents are valid HAT EEPROM contents and returns a list of namedtuples
containing information on the HAT.  Info will only be returned for DAQ HATs.
The EEPROM contents are stored in /etc/mcc/hats when using the
daqhats_read_eeproms tool, or in /proc/device-tree in the case of a single
HAT at address 0.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filter_by_id</strong> (<em>int</em>) – If this is <a class="reference internal" href="#daqhats.HatIDs.ANY" title="daqhats.HatIDs.ANY"><code class="xref py py-const docutils literal notranslate"><span class="pre">HatIDs.ANY</span></code></a> return all DAQ
HATs found.  Otherwise, return only DAQ HATs with ID matching this
value.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A list of namedtuples, the number of elements match the number of
DAQ HATs found. Each namedtuple will contain the following field names<ul class="simple">
<li><strong>address</strong> (int): device address</li>
<li><strong>id</strong> (int): device product ID, identifies the type of DAQ HAT</li>
<li><strong>version</strong> (int): device hardware version</li>
<li><strong>product_name</strong> (str): device product name</li>
</ul>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="daqhats.interrupt_state">
<code class="descclassname">daqhats.</code><code class="descname">interrupt_state</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.interrupt_state" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the current DAQ HAT interrupt status</p>
<p>Returns the status of the interrupt signal, True if active or False if
inactive. The signal can be shared by multiple DAQ HATs so the status of
each board that may generate an interrupt must be read and the interrupt
source(s) cleared before the interrupt will become inactive.</p>
<p>This function only applies when using devices that can generate an
interrupt:</p>
<ul class="simple">
<li>MCC 152</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The interrupt status.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="daqhats.wait_for_interrupt">
<code class="descclassname">daqhats.</code><code class="descname">wait_for_interrupt</code><span class="sig-paren">(</span><em>timeout</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.wait_for_interrupt" title="Permalink to this definition">¶</a></dt>
<dd><p>Wait for an interrupt from a DAQ HAT to occur.</p>
<p>Pass a timeout in seconds. Pass -1 to wait forever or 0 to return
immediately. If the interrupt has not occurred before the timeout elapses
the function will return False.</p>
<p>This function only applies when using devices that can generate an
interrupt:</p>
<ul class="simple">
<li>MCC 152</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The interrupt status - True = interrupt active, False = interrupt
inactive.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="daqhats.interrupt_callback_enable">
<code class="descclassname">daqhats.</code><code class="descname">interrupt_callback_enable</code><span class="sig-paren">(</span><em>callback</em>, <em>user_data</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.interrupt_callback_enable" title="Permalink to this definition">¶</a></dt>
<dd><p>Enable an interrupt callback function.</p>
<p>Set a function that will be called when a DAQ HAT interrupt occurs.</p>
<p>The function will be called when the DAQ HAT interrupt signal becomes
active, and cannot be called again until the interrupt signal becomes
inactive. Active sources become inactive when manually cleared (such as
reading the digital I/O inputs or clearing the interrupt enable.) If not
latched, an active source also becomes inactive when the value returns to
the original value (the value at the source before the interrupt was
generated.)</p>
<p>There may only be one callback function at a time; if you call this
when a function is already set as the callback function then it will be
replaced with the new function and the old function will no longer be called
if an interrupt occurs. The data argument to this function will be passed
to the callback function when it is called.</p>
<p>The callback function must have the form “callback(user_data)”. For
example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">my_function</span><span class="p">(</span><span class="n">data</span><span class="p">):</span>
    <span class="c1"># This is my callback function.</span>
    <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;The interrupt occurred, and returned </span><span class="si">{}</span><span class="s2">.&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">data</span><span class="p">))</span>
    <span class="n">data</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+=</span> <span class="mi">1</span>

<span class="n">value</span> <span class="o">=</span> <span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="n">interrupt_enable_callback</span><span class="p">(</span><span class="n">my_function</span><span class="p">,</span> <span class="n">value</span><span class="p">)</span>
</pre></div>
</div>
<p>In this example <em>my_function()</em> will be called when the interrupt occurs,
and the list <em>value</em> will be passed as the user_data. Inside the callback it
will be received as <em>data</em>, but will still be the same object so any changes
made will be present in the original <em>value</em>. Every time the interrupt
occurs <em>value[0]</em> will be incremented and a higher number will be printed.</p>
<p>An integer was not used for <em>value</em> because integers are immutable in Python
so the original <em>value</em> would never change.</p>
<p>The callback may be disabled with <a class="reference internal" href="#daqhats.interrupt_callback_disable" title="daqhats.interrupt_callback_disable"><code class="xref py py-func docutils literal notranslate"><span class="pre">interrupt_callback_disable()</span></code></a>.</p>
<p>This function only applies when using devices that can generate an
interrupt:</p>
<ul class="simple">
<li>MCC 152</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>callback</strong> (<em>callback function</em>) – The callback function.</li>
<li><strong>user_data</strong> (<em>object</em>) – callback function.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-exc docutils literal notranslate"><span class="pre">Exception</span></code> – Internal error enabling the callback.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="daqhats.interrupt_callback_disable">
<code class="descclassname">daqhats.</code><code class="descname">interrupt_callback_disable</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.interrupt_callback_disable" title="Permalink to this definition">¶</a></dt>
<dd><p>Disable interrupt callbacks.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><code class="xref py py-exc docutils literal notranslate"><span class="pre">Exception</span></code> – Internal error disabling the callback.</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
<div class="section" id="data">
<h3>Data<a class="headerlink" href="#data" title="Permalink to this headline">¶</a></h3>
<div class="section" id="hat-ids">
<h4>Hat IDs<a class="headerlink" href="#hat-ids" title="Permalink to this headline">¶</a></h4>
<dl class="class">
<dt id="daqhats.HatIDs">
<em class="property">class </em><code class="descclassname">daqhats.</code><code class="descname">HatIDs</code><a class="headerlink" href="#daqhats.HatIDs" title="Permalink to this definition">¶</a></dt>
<dd><p>Known MCC HAT IDs.</p>
<dl class="attribute">
<dt id="daqhats.HatIDs.ANY">
<code class="descname">ANY</code><em class="property"> = 0</em><a class="headerlink" href="#daqhats.HatIDs.ANY" title="Permalink to this definition">¶</a></dt>
<dd><p>Match any MCC ID in <a class="reference internal" href="#daqhats.hat_list" title="daqhats.hat_list"><code class="xref py py-func docutils literal notranslate"><span class="pre">hat_list()</span></code></a></p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.HatIDs.MCC_118">
<code class="descname">MCC_118</code><em class="property"> = 322</em><a class="headerlink" href="#daqhats.HatIDs.MCC_118" title="Permalink to this definition">¶</a></dt>
<dd><p>MCC 118 ID</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.HatIDs.MCC_134">
<code class="descname">MCC_134</code><em class="property"> = 323</em><a class="headerlink" href="#daqhats.HatIDs.MCC_134" title="Permalink to this definition">¶</a></dt>
<dd><p>MCC 134 ID</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.HatIDs.MCC_152">
<code class="descname">MCC_152</code><em class="property"> = 324</em><a class="headerlink" href="#daqhats.HatIDs.MCC_152" title="Permalink to this definition">¶</a></dt>
<dd><p>MCC 152 ID</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="trigger-modes">
<h4>Trigger modes<a class="headerlink" href="#trigger-modes" title="Permalink to this headline">¶</a></h4>
<dl class="class">
<dt id="daqhats.TriggerModes">
<em class="property">class </em><code class="descclassname">daqhats.</code><code class="descname">TriggerModes</code><a class="headerlink" href="#daqhats.TriggerModes" title="Permalink to this definition">¶</a></dt>
<dd><p>Scan trigger input modes.</p>
<dl class="attribute">
<dt id="daqhats.TriggerModes.RISING_EDGE">
<code class="descname">RISING_EDGE</code><em class="property"> = 0</em><a class="headerlink" href="#daqhats.TriggerModes.RISING_EDGE" title="Permalink to this definition">¶</a></dt>
<dd><p>Start the scan on a rising edge of TRIG.</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.TriggerModes.FALLING_EDGE">
<code class="descname">FALLING_EDGE</code><em class="property"> = 1</em><a class="headerlink" href="#daqhats.TriggerModes.FALLING_EDGE" title="Permalink to this definition">¶</a></dt>
<dd><p>Start the scan on a falling edge of TRIG.</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.TriggerModes.ACTIVE_HIGH">
<code class="descname">ACTIVE_HIGH</code><em class="property"> = 2</em><a class="headerlink" href="#daqhats.TriggerModes.ACTIVE_HIGH" title="Permalink to this definition">¶</a></dt>
<dd><p>Start the scan any time TRIG is high.</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.TriggerModes.ACTIVE_LOW">
<code class="descname">ACTIVE_LOW</code><em class="property"> = 3</em><a class="headerlink" href="#daqhats.TriggerModes.ACTIVE_LOW" title="Permalink to this definition">¶</a></dt>
<dd><p>Start the scan any time TRIG is low.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="scan-read-option-flags">
<h4>Scan / read option flags<a class="headerlink" href="#scan-read-option-flags" title="Permalink to this headline">¶</a></h4>
<dl class="class">
<dt id="daqhats.OptionFlags">
<em class="property">class </em><code class="descclassname">daqhats.</code><code class="descname">OptionFlags</code><a class="headerlink" href="#daqhats.OptionFlags" title="Permalink to this definition">¶</a></dt>
<dd><p>Scan / read option flags. See individual methods for detailed
descriptions.</p>
<dl class="attribute">
<dt id="daqhats.OptionFlags.DEFAULT">
<code class="descname">DEFAULT</code><em class="property"> = 0</em><a class="headerlink" href="#daqhats.OptionFlags.DEFAULT" title="Permalink to this definition">¶</a></dt>
<dd><p>Use default behavior.</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.OptionFlags.NOSCALEDATA">
<code class="descname">NOSCALEDATA</code><em class="property"> = 1</em><a class="headerlink" href="#daqhats.OptionFlags.NOSCALEDATA" title="Permalink to this definition">¶</a></dt>
<dd><p>Read / write unscaled data.</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.OptionFlags.NOCALIBRATEDATA">
<code class="descname">NOCALIBRATEDATA</code><em class="property"> = 2</em><a class="headerlink" href="#daqhats.OptionFlags.NOCALIBRATEDATA" title="Permalink to this definition">¶</a></dt>
<dd><p>Read / write uncalibrated data.</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.OptionFlags.EXTCLOCK">
<code class="descname">EXTCLOCK</code><em class="property"> = 4</em><a class="headerlink" href="#daqhats.OptionFlags.EXTCLOCK" title="Permalink to this definition">¶</a></dt>
<dd><p>Use an external clock source.</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.OptionFlags.EXTTRIGGER">
<code class="descname">EXTTRIGGER</code><em class="property"> = 8</em><a class="headerlink" href="#daqhats.OptionFlags.EXTTRIGGER" title="Permalink to this definition">¶</a></dt>
<dd><p>Use an external trigger source.</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.OptionFlags.CONTINUOUS">
<code class="descname">CONTINUOUS</code><em class="property"> = 16</em><a class="headerlink" href="#daqhats.OptionFlags.CONTINUOUS" title="Permalink to this definition">¶</a></dt>
<dd><p>Run until explicitly stopped.</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.OptionFlags.TEMPERATURE">
<code class="descname">TEMPERATURE</code><em class="property"> = 32</em><a class="headerlink" href="#daqhats.OptionFlags.TEMPERATURE" title="Permalink to this definition">¶</a></dt>
<dd><p>Return temperature (MCC 134)</p>
</dd></dl>

</dd></dl>

</div>
</div>
<div class="section" id="haterror-class">
<h3>HatError class<a class="headerlink" href="#haterror-class" title="Permalink to this headline">¶</a></h3>
<dl class="exception">
<dt id="daqhats.HatError">
<em class="property">exception </em><code class="descclassname">daqhats.</code><code class="descname">HatError</code><span class="sig-paren">(</span><em>address</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.HatError" title="Permalink to this definition">¶</a></dt>
<dd><p>Exceptions raised for MCC DAQ HAT specific errors.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>address</strong> (<em>int</em>) – the address of the board that caused the exception.</li>
<li><strong>value</strong> (<em>str</em>) – the exception description.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
</div>
<div class="section" id="mcc-118-class">
<h2>MCC 118 class<a class="headerlink" href="#mcc-118-class" title="Permalink to this headline">¶</a></h2>
<div class="section" id="id1">
<h3>Methods<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="daqhats.mcc118">
<em class="property">class </em><code class="descclassname">daqhats.</code><code class="descname">mcc118</code><span class="sig-paren">(</span><em>address=0</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118" title="Permalink to this definition">¶</a></dt>
<dd><p>The class for an MCC 118 board.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>address</strong> (<em>int</em>) – board address, must be 0-7.</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board did not respond or was of an incorrect type</td>
</tr>
</tbody>
</table>
<p class="rubric">Methods</p>
<table border="1" class="docutils">
<colgroup>
<col width="47%" />
<col width="53%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td>Method</td>
<td>Description</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc118.info" title="daqhats.mcc118.info"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.info()</span></code></a></td>
<td>Get info about this device type.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc118.firmware_version" title="daqhats.mcc118.firmware_version"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.firmware_version()</span></code></a></td>
<td>Get the firmware version.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc118.serial" title="daqhats.mcc118.serial"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.serial()</span></code></a></td>
<td>Read the serial number.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc118.blink_led" title="daqhats.mcc118.blink_led"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.blink_led()</span></code></a></td>
<td>Blink the MCC 118 LED.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc118.calibration_date" title="daqhats.mcc118.calibration_date"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.calibration_date()</span></code></a></td>
<td>Read the calibration date.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc118.calibration_coefficient_read" title="daqhats.mcc118.calibration_coefficient_read"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.calibration_coefficient_read()</span></code></a></td>
<td>Read the calibration coefficients for a channel.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc118.calibration_coefficient_write" title="daqhats.mcc118.calibration_coefficient_write"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.calibration_coefficient_write()</span></code></a></td>
<td>Write the calibration coefficients for a channel.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc118.trigger_mode" title="daqhats.mcc118.trigger_mode"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.trigger_mode()</span></code></a></td>
<td>Set the external trigger input mode.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc118.a_in_read" title="daqhats.mcc118.a_in_read"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.a_in_read()</span></code></a></td>
<td>Read an analog input channel.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc118.a_in_scan_actual_rate" title="daqhats.mcc118.a_in_scan_actual_rate"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.a_in_scan_actual_rate()</span></code></a></td>
<td>Read the actual sample rate for a requested sample rate.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc118.a_in_scan_start" title="daqhats.mcc118.a_in_scan_start"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.a_in_scan_start()</span></code></a></td>
<td>Start a hardware-paced analog input scan.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc118.a_in_scan_buffer_size" title="daqhats.mcc118.a_in_scan_buffer_size"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.a_in_scan_buffer_size()</span></code></a></td>
<td>Read the size of the internal scan data buffer.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc118.a_in_scan_read" title="daqhats.mcc118.a_in_scan_read"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.a_in_scan_read()</span></code></a></td>
<td>Read scan status / data (list).</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc118.a_in_scan_read_numpy" title="daqhats.mcc118.a_in_scan_read_numpy"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.a_in_scan_read_numpy()</span></code></a></td>
<td>Read scan status / data (NumPy array).</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc118.a_in_scan_channel_count" title="daqhats.mcc118.a_in_scan_channel_count"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.a_in_scan_channel_count()</span></code></a></td>
<td>Get the number of channels in the current scan.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc118.a_in_scan_stop" title="daqhats.mcc118.a_in_scan_stop"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.a_in_scan_stop()</span></code></a></td>
<td>Stop the scan.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc118.a_in_scan_cleanup" title="daqhats.mcc118.a_in_scan_cleanup"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.a_in_scan_cleanup()</span></code></a></td>
<td>Free scan resources.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc118.address" title="daqhats.mcc118.address"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc118.address()</span></code></a></td>
<td>Read the board’s address.</td>
</tr>
</tbody>
</table>
<dl class="staticmethod">
<dt id="daqhats.mcc118.info">
<em class="property">static </em><code class="descname">info</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.info" title="Permalink to this definition">¶</a></dt>
<dd><p>Return constant information about this type of device.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">a namedtuple containing the following field names<ul class="simple">
<li><strong>NUM_AI_CHANNELS</strong> (int): The number of analog input channels
(8.)</li>
<li><strong>AI_MIN_CODE</strong> (int): The minimum ADC code (0.)</li>
<li><strong>AI_MAX_CODE</strong> (int): The maximum ADC code (4095.)</li>
<li><strong>AI_MIN_VOLTAGE</strong> (float): The voltage corresponding to the
minimum ADC code (-10.0.)</li>
<li><strong>AI_MAX_VOLTAGE</strong> (float): The voltage corresponding to the
maximum ADC code (+10.0 - 1 LSB)</li>
<li><strong>AI_MIN_RANGE</strong> (float): The minimum voltage of the input range
(-10.0.)</li>
<li><strong>AI_MAX_RANGE</strong> (float): The maximum voltage of the input range
(+10.0.)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">namedtuple</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.firmware_version">
<code class="descname">firmware_version</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.firmware_version" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the board firmware and bootloader versions.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">a namedtuple containing the following field names<ul class="simple">
<li><strong>version</strong> (string): The firmware version, i.e “1.03”.</li>
<li><strong>bootloader_version</strong> (string): The bootloader version,
i.e “1.01”.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">namedtuple</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.serial">
<code class="descname">serial</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.serial" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the serial number.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The serial number.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.blink_led">
<code class="descname">blink_led</code><span class="sig-paren">(</span><em>count</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.blink_led" title="Permalink to this definition">¶</a></dt>
<dd><p>Blink the MCC 118 LED.</p>
<p>Setting count to 0 will cause the LED to blink continuously until
blink_led() is called again with a non-zero count.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>count</strong> (<em>int</em>) – The number of times to blink (max 255).</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.calibration_date">
<code class="descname">calibration_date</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.calibration_date" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the calibration date.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The calibration date in the format “YYYY-MM-DD”.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.calibration_coefficient_read">
<code class="descname">calibration_coefficient_read</code><span class="sig-paren">(</span><em>channel</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.calibration_coefficient_read" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the calibration coefficients for a single channel.</p>
<p>The coefficients are applied in the library as:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">calibrated_ADC_code</span> <span class="o">=</span> <span class="p">(</span><span class="n">raw_ADC_code</span> <span class="o">*</span> <span class="n">slope</span><span class="p">)</span> <span class="o">+</span> <span class="n">offset</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">a namedtuple containing the following field names<ul class="simple">
<li><strong>slope</strong> (float): The slope.</li>
<li><strong>offset</strong> (float): The offset.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">namedtuple</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.calibration_coefficient_write">
<code class="descname">calibration_coefficient_write</code><span class="sig-paren">(</span><em>channel</em>, <em>slope</em>, <em>offset</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.calibration_coefficient_write" title="Permalink to this definition">¶</a></dt>
<dd><p>Temporarily write the calibration coefficients for a single channel.</p>
<p>The user can apply their own calibration coefficients by writing to
these values. The values will reset to the factory values from the
EEPROM whenever the class is initialized.  This function will fail and
raise a HatError exception if a scan is active when it is called.</p>
<p>The coefficients are applied in the library as:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">calibrated_ADC_code</span> <span class="o">=</span> <span class="p">(</span><span class="n">raw_ADC_code</span> <span class="o">*</span> <span class="n">slope</span><span class="p">)</span> <span class="o">+</span> <span class="n">offset</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>slope</strong> (<em>float</em>) – The new slope value.</li>
<li><strong>offset</strong> (<em>float</em>) – The new offset value.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.trigger_mode">
<code class="descname">trigger_mode</code><span class="sig-paren">(</span><em>mode</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.trigger_mode" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the external trigger input mode.</p>
<p>The available modes are:</p>
<ul class="simple">
<li><a class="reference internal" href="#daqhats.TriggerModes.RISING_EDGE" title="daqhats.TriggerModes.RISING_EDGE"><code class="xref py py-const docutils literal notranslate"><span class="pre">TriggerModes.RISING_EDGE</span></code></a>: Start the scan when the TRIG
input transitions from low to high.</li>
<li><a class="reference internal" href="#daqhats.TriggerModes.FALLING_EDGE" title="daqhats.TriggerModes.FALLING_EDGE"><code class="xref py py-const docutils literal notranslate"><span class="pre">TriggerModes.FALLING_EDGE</span></code></a>: Start the scan when the TRIG
input transitions from high to low.</li>
<li><a class="reference internal" href="#daqhats.TriggerModes.ACTIVE_HIGH" title="daqhats.TriggerModes.ACTIVE_HIGH"><code class="xref py py-const docutils literal notranslate"><span class="pre">TriggerModes.ACTIVE_HIGH</span></code></a>: Start the scan when the TRIG
input is high.</li>
<li><a class="reference internal" href="#daqhats.TriggerModes.ACTIVE_LOW" title="daqhats.TriggerModes.ACTIVE_LOW"><code class="xref py py-const docutils literal notranslate"><span class="pre">TriggerModes.ACTIVE_LOW</span></code></a>: Start the scan when the TRIG
input is low.</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>mode</strong> (<a class="reference internal" href="#daqhats.TriggerModes" title="daqhats.TriggerModes"><code class="xref py py-class docutils literal notranslate"><span class="pre">TriggerModes</span></code></a>) – The trigger mode.</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.a_in_read">
<code class="descname">a_in_read</code><span class="sig-paren">(</span><em>channel</em>, <em>options=&lt;OptionFlags.DEFAULT: 0&gt;</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.a_in_read" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform a single reading of an analog input channel and return the
value.</p>
<p><strong>options</strong> is an ORed combination of OptionFlags. Valid flags for this
method are:</p>
<ul class="simple">
<li><a class="reference internal" href="#daqhats.OptionFlags.DEFAULT" title="daqhats.OptionFlags.DEFAULT"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.DEFAULT</span></code></a>: Return a calibrated voltage value.
Any other flags will override DEFAULT behavior.</li>
<li><a class="reference internal" href="#daqhats.OptionFlags.NOSCALEDATA" title="daqhats.OptionFlags.NOSCALEDATA"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.NOSCALEDATA</span></code></a>: Return an ADC code (a value
between 0 and 4095) rather than voltage.</li>
<li><a class="reference internal" href="#daqhats.OptionFlags.NOCALIBRATEDATA" title="daqhats.OptionFlags.NOCALIBRATEDATA"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.NOCALIBRATEDATA</span></code></a>: Return data without the
calibration factors applied.</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>channel</strong> (<em>int</em>) – The analog input channel number, 0-7.</li>
<li><strong>options</strong> (<em>int</em>) – ORed combination of <a class="reference internal" href="#daqhats.OptionFlags" title="daqhats.OptionFlags"><code class="xref py py-class docutils literal notranslate"><span class="pre">OptionFlags</span></code></a>,
<a class="reference internal" href="#daqhats.OptionFlags.DEFAULT" title="daqhats.OptionFlags.DEFAULT"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.DEFAULT</span></code></a> if unspecified.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the read value</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">float</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – the channel number is invalid.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.a_in_scan_actual_rate">
<code class="descname">a_in_scan_actual_rate</code><span class="sig-paren">(</span><em>channel_count</em>, <em>sample_rate_per_channel</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.a_in_scan_actual_rate" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the actual sample rate per channel for a requested sample rate.</p>
<p>The internal scan clock is generated from a 16 MHz clock source so only
discrete frequency steps can be achieved.  This function will return the
actual rate for a requested channel count and rate setting.</p>
<p>This function does not perform any actions with a board, it simply
calculates the rate.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>channel_count</strong> (<em>int</em>) – The number of channels in the scan, 1-8.</li>
<li><strong>sample_rate_per_channel</strong> (<em>float</em>) – The desired per-channel rate of the
internal sampling clock, max 100,000.0.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the actual sample rate</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">float</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – a scan argument is invalid.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.a_in_scan_start">
<code class="descname">a_in_scan_start</code><span class="sig-paren">(</span><em>channel_mask</em>, <em>samples_per_channel</em>, <em>sample_rate_per_channel</em>, <em>options</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.a_in_scan_start" title="Permalink to this definition">¶</a></dt>
<dd><p>Start a hardware-paced analog input channel scan.</p>
<p>The scan runs as a separate thread from the user’s code. This function
will allocate a scan buffer and start the thread that reads data from
the device into that buffer. The user reads the data from the scan
buffer and the scan status using the <a class="reference internal" href="#daqhats.mcc118.a_in_scan_read" title="daqhats.mcc118.a_in_scan_read"><code class="xref py py-func docutils literal notranslate"><span class="pre">a_in_scan_read()</span></code></a> function.
<a class="reference internal" href="#daqhats.mcc118.a_in_scan_stop" title="daqhats.mcc118.a_in_scan_stop"><code class="xref py py-func docutils literal notranslate"><span class="pre">a_in_scan_stop()</span></code></a> is used to stop a continuous scan, or to stop
a finite scan before it completes. The user must call
<a class="reference internal" href="#daqhats.mcc118.a_in_scan_cleanup" title="daqhats.mcc118.a_in_scan_cleanup"><code class="xref py py-func docutils literal notranslate"><span class="pre">a_in_scan_cleanup()</span></code></a> after the scan has finished and all desired
data has been read; this frees all resources from the scan and allows
additional scans to be performed.</p>
<p>The scan state has defined terminology:</p>
<ul class="simple">
<li><strong>Active</strong>: <a class="reference internal" href="#daqhats.mcc118.a_in_scan_start" title="daqhats.mcc118.a_in_scan_start"><code class="xref py py-func docutils literal notranslate"><span class="pre">a_in_scan_start()</span></code></a> has been called and the device
may be acquiring data or finished with the acquisition. The scan has
not been cleaned up by calling <a class="reference internal" href="#daqhats.mcc118.a_in_scan_cleanup" title="daqhats.mcc118.a_in_scan_cleanup"><code class="xref py py-func docutils literal notranslate"><span class="pre">a_in_scan_cleanup()</span></code></a>, so
another scan may not be started.</li>
<li><strong>Running</strong>: The scan is active and the device is still acquiring
data. Certain methods like <a class="reference internal" href="#daqhats.mcc118.a_in_read" title="daqhats.mcc118.a_in_read"><code class="xref py py-func docutils literal notranslate"><span class="pre">a_in_read()</span></code></a> will return an error
because the device is busy.</li>
</ul>
<p>The scan options that may be used are:</p>
<ul class="simple">
<li><a class="reference internal" href="#daqhats.OptionFlags.DEFAULT" title="daqhats.OptionFlags.DEFAULT"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.DEFAULT</span></code></a>: Return scaled and calibrated data,
internal scan clock, no trigger, and finite operation. Any other flags
will override DEFAULT behavior.</li>
<li><a class="reference internal" href="#daqhats.OptionFlags.NOSCALEDATA" title="daqhats.OptionFlags.NOSCALEDATA"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.NOSCALEDATA</span></code></a>: Return ADC codes (values between
0 and 4095) rather than voltage.</li>
<li><a class="reference internal" href="#daqhats.OptionFlags.NOCALIBRATEDATA" title="daqhats.OptionFlags.NOCALIBRATEDATA"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.NOCALIBRATEDATA</span></code></a>: Return data without the
calibration factors applied.</li>
<li><a class="reference internal" href="#daqhats.OptionFlags.EXTCLOCK" title="daqhats.OptionFlags.EXTCLOCK"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.EXTCLOCK</span></code></a>: Use an external 3.3V or 5V logic
signal at the CLK input as the scan clock. Multiple devices can be
synchronized by connecting the CLK pins together and using this flag
on all but one device so they will be clocked by the single device
using its internal clock. <strong>sample_rate_per_channel</strong> is only used for
buffer sizing.</li>
<li><a class="reference internal" href="#daqhats.OptionFlags.EXTTRIGGER" title="daqhats.OptionFlags.EXTTRIGGER"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.EXTTRIGGER</span></code></a>: Hold off the scan (after calling
<a class="reference internal" href="#daqhats.mcc118.a_in_scan_start" title="daqhats.mcc118.a_in_scan_start"><code class="xref py py-func docutils literal notranslate"><span class="pre">a_in_scan_start()</span></code></a>) until the trigger condition is met. The
trigger is a 3.3V or 5V logic signal applied to the TRIG pin.</li>
<li><a class="reference internal" href="#daqhats.OptionFlags.CONTINUOUS" title="daqhats.OptionFlags.CONTINUOUS"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.CONTINUOUS</span></code></a>: Scans continuously until stopped
by the user by calling <a class="reference internal" href="#daqhats.mcc118.a_in_scan_stop" title="daqhats.mcc118.a_in_scan_stop"><code class="xref py py-func docutils literal notranslate"><span class="pre">a_in_scan_stop()</span></code></a> and writes data to a
circular buffer. The data must be read before being overwritten to
avoid a buffer overrun error. <strong>samples_per_channel</strong> is only used for
buffer sizing.</li>
</ul>
<p>The scan buffer size will be allocated as follows:</p>
<p><strong>Finite mode:</strong> Total number of samples in the scan.</p>
<p><strong>Continuous mode:</strong> Either <strong>samples_per_channel</strong> or the value in the
table below, whichever is greater.</p>
<table border="1" class="docutils">
<colgroup>
<col width="36%" />
<col width="64%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Sample Rate</th>
<th class="head">Buffer Size (per channel)</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>Not specified</td>
<td>10 kS</td>
</tr>
<tr class="row-odd"><td>0-100 S/s</td>
<td>1 kS</td>
</tr>
<tr class="row-even"><td>100-10k S/s</td>
<td>10 kS</td>
</tr>
<tr class="row-odd"><td>10k-100k S/s</td>
<td>100 kS</td>
</tr>
</tbody>
</table>
<p>Specifying a very large value for samples_per_channel could use too much
of the Raspberry Pi memory. If the memory allocation fails, the function
will raise a HatError with this description. The allocation could
succeed, but the lack of free memory could cause other problems in the
Raspberry Pi. If you need to acquire a high number of samples then it is
better to run the scan in continuous mode and stop it when you have
acquired the desired amount of data. If a scan is active this method
will raise a HatError.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>channel_mask</strong> (<em>int</em>) – A bit mask of the desired channels (0x01 -
0xFF).</li>
<li><strong>samples_per_channel</strong> (<em>int</em>) – The number of samples to acquire per
channel (finite mode,) or or can be used to set a larger scan
buffer size than the default value (continuous mode.)</li>
<li><strong>sample_rate_per_channel</strong> (<em>float</em>) – The per-channel rate of the
internal scan clock, or the expected maximum rate of an external
scan clock, max 100,000.0.</li>
<li><strong>options</strong> (<em>int</em>) – An ORed combination of <a class="reference internal" href="#daqhats.OptionFlags" title="daqhats.OptionFlags"><code class="xref py py-class docutils literal notranslate"><span class="pre">OptionFlags</span></code></a> flags
that control the scan.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – a scan is active; memory could not be allocated; the board
is not initialized, does not respond, or responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – a scan argument is invalid.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.a_in_scan_buffer_size">
<code class="descname">a_in_scan_buffer_size</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.a_in_scan_buffer_size" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the internal scan data buffer size.</p>
<p>An internal data buffer is allocated for the scan when
<a class="reference internal" href="#daqhats.mcc118.a_in_scan_start" title="daqhats.mcc118.a_in_scan_start"><code class="xref py py-func docutils literal notranslate"><span class="pre">a_in_scan_start()</span></code></a> is called. This function returns the total
size of that buffer in samples.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the buffer size in samples</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">int</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized or no scan buffer is
allocated (a scan is not active).</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.a_in_scan_status">
<code class="descname">a_in_scan_status</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.a_in_scan_status" title="Permalink to this definition">¶</a></dt>
<dd><p>Read scan status and number of available samples per channel.</p>
<p>The analog input scan is started with <a class="reference internal" href="#daqhats.mcc118.a_in_scan_start" title="daqhats.mcc118.a_in_scan_start"><code class="xref py py-func docutils literal notranslate"><span class="pre">a_in_scan_start()</span></code></a> and
runs in the background.  This function reads the status of that
background scan and the number of samples per channel available in
the scan thread buffer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">a namedtuple containing the following field names:<ul class="simple">
<li><strong>running</strong> (bool): True if the scan is running, False if it has
stopped or completed.</li>
<li><strong>hardware_overrun</strong> (bool): True if the hardware could not
acquire and unload samples fast enough and data was lost.</li>
<li><strong>buffer_overrun</strong> (bool): True if the background scan buffer was
not read fast enough and data was lost.</li>
<li><strong>triggered</strong> (bool): True if the trigger conditions have been met
and data acquisition started.</li>
<li><strong>samples_available</strong> (int): The number of samples per channel
currently in the scan buffer.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">namedtuple</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – A scan is not active, the board is not initialized, does
not respond, or responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.a_in_scan_read">
<code class="descname">a_in_scan_read</code><span class="sig-paren">(</span><em>samples_per_channel</em>, <em>timeout</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.a_in_scan_read" title="Permalink to this definition">¶</a></dt>
<dd><p>Read scan status and data (as a list).</p>
<p>The analog input scan is started with <a class="reference internal" href="#daqhats.mcc118.a_in_scan_start" title="daqhats.mcc118.a_in_scan_start"><code class="xref py py-func docutils literal notranslate"><span class="pre">a_in_scan_start()</span></code></a> and
runs in the background.  This function reads the status of that
background scan and optionally reads sampled data from the scan buffer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>samples_per_channel</strong> (<em>int</em>) – The number of samples per channel to read
from the scan buffer. Specify a negative number to return all
available samples immediately and ignore <strong>timeout</strong> or 0 to
only read the scan status and return no data.</li>
<li><strong>timeout</strong> (<em>float</em>) – The amount of time in seconds to wait for the
samples to be read. Specify a negative number to wait
indefinitely, or 0 to return immediately with the samples that
are already in the scan buffer (up to <strong>samples_per_channel</strong>.)
If the timeout is met and the specified number of samples have
not been read, then the function will return all the available
samples and the timeout status set.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><p>a namedtuple containing the following field names:</p>
<ul class="simple">
<li><strong>running</strong> (bool): True if the scan is running, False if it has
stopped or completed.</li>
<li><strong>hardware_overrun</strong> (bool): True if the hardware could not
acquire and unload samples fast enough and data was lost.</li>
<li><strong>buffer_overrun</strong> (bool): True if the background scan buffer was
not read fast enough and data was lost.</li>
<li><strong>triggered</strong> (bool): True if the trigger conditions have been met
and data acquisition started.</li>
<li><strong>timeout</strong> (bool): True if the timeout time expired before the
specified number of samples were read.</li>
<li><strong>data</strong> (list of float): The data that was read from the scan
buffer.</li>
</ul>
</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">namedtuple</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – A scan is not active, the board is not initialized, does
not respond, or responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – Incorrect argument.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.a_in_scan_read_numpy">
<code class="descname">a_in_scan_read_numpy</code><span class="sig-paren">(</span><em>samples_per_channel</em>, <em>timeout</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.a_in_scan_read_numpy" title="Permalink to this definition">¶</a></dt>
<dd><p>Read scan status and data (as a NumPy array).</p>
<p>This function is similar to <a class="reference internal" href="#daqhats.mcc118.a_in_scan_read" title="daqhats.mcc118.a_in_scan_read"><code class="xref py py-func docutils literal notranslate"><span class="pre">a_in_scan_read()</span></code></a> except that the
<em>data</em> key in the returned namedtuple is a NumPy array of float64 values
and may be used directly with NumPy functions.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>samples_per_channel</strong> (<em>int</em>) – The number of samples per channel to read
from the scan buffer.  Specify a negative number to read all
available samples or 0 to only read the scan status and return
no data.</li>
<li><strong>timeout</strong> (<em>float</em>) – The amount of time in seconds to wait for the
samples to be read.  Specify a negative number to wait
indefinitely, or 0 to return immediately with the samples that
are already in the scan buffer.  If the timeout is met and the
specified number of samples have not been read, then the
function will return with the amount that has been read and the
timeout status set.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><p>a namedtuple containing the following field names:</p>
<ul class="simple">
<li><strong>running</strong> (bool): True if the scan is running, False if it has
stopped or completed.</li>
<li><strong>hardware_overrun</strong> (bool): True if the hardware could not
acquire and unload samples fast enough and data was lost.</li>
<li><strong>buffer_overrun</strong> (bool): True if the background scan buffer was
not read fast enough and data was lost.</li>
<li><strong>triggered</strong> (bool): True if the trigger conditions have been met
and data acquisition started.</li>
<li><strong>timeout</strong> (bool): True if the timeout time expired before the
specified number of samples were read.</li>
<li><strong>data</strong> (NumPy array of float64): The data that was read from the
scan buffer.</li>
</ul>
</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">namedtuple</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – A scan is not active, the board is not initialized, does
not respond, or responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – Incorrect argument.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.a_in_scan_channel_count">
<code class="descname">a_in_scan_channel_count</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.a_in_scan_channel_count" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the number of channels in the current analog input scan.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the number of channels (0 if no scan is active, 1-8 otherwise)</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">int</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.a_in_scan_stop">
<code class="descname">a_in_scan_stop</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.a_in_scan_stop" title="Permalink to this definition">¶</a></dt>
<dd><p>Stops an analog input scan.</p>
<p>The device stops acquiring data immediately. The scan data that has been
read into the scan buffer is available until
<a class="reference internal" href="#daqhats.mcc118.a_in_scan_cleanup" title="daqhats.mcc118.a_in_scan_cleanup"><code class="xref py py-func docutils literal notranslate"><span class="pre">a_in_scan_cleanup()</span></code></a> is called.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.a_in_scan_cleanup">
<code class="descname">a_in_scan_cleanup</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.a_in_scan_cleanup" title="Permalink to this definition">¶</a></dt>
<dd><p>Free analog input scan resources after the scan is complete.</p>
<p>This will free the scan buffer and other resources used by the
background scan and make it possible to start another scan with
<a class="reference internal" href="#daqhats.mcc118.a_in_scan_start" title="daqhats.mcc118.a_in_scan_start"><code class="xref py py-func docutils literal notranslate"><span class="pre">a_in_scan_start()</span></code></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc118.address">
<code class="descname">address</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc118.address" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the device address.</p>
</dd></dl>

</dd></dl>

</div>
</div>
<div class="section" id="mcc-134-class">
<h2>MCC 134 class<a class="headerlink" href="#mcc-134-class" title="Permalink to this headline">¶</a></h2>
<div class="section" id="id2">
<h3>Methods<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="daqhats.mcc134">
<em class="property">class </em><code class="descclassname">daqhats.</code><code class="descname">mcc134</code><span class="sig-paren">(</span><em>address=0</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc134" title="Permalink to this definition">¶</a></dt>
<dd><p>The class for an MCC 134 board.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>address</strong> (<em>int</em>) – board address, must be 0-7.</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board did not respond or was of an incorrect type</td>
</tr>
</tbody>
</table>
<p class="rubric">Methods</p>
<table border="1" class="docutils">
<colgroup>
<col width="46%" />
<col width="54%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td>Method</td>
<td>Description</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc134.info" title="daqhats.mcc134.info"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc134.info()</span></code></a></td>
<td>Get info about this device type.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc134.serial" title="daqhats.mcc134.serial"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc134.serial()</span></code></a></td>
<td>Read the serial number.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc134.calibration_date" title="daqhats.mcc134.calibration_date"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc134.calibration_date()</span></code></a></td>
<td>Read the calibration date.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc134.calibration_coefficient_read" title="daqhats.mcc134.calibration_coefficient_read"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc134.calibration_coefficient_read()</span></code></a></td>
<td>Read the calibration coefficients for a channel.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc134.calibration_coefficient_write" title="daqhats.mcc134.calibration_coefficient_write"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc134.calibration_coefficient_write()</span></code></a></td>
<td>Write the calibration coefficients for a channel.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc134.tc_type_write" title="daqhats.mcc134.tc_type_write"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc134.tc_type_write()</span></code></a></td>
<td>Write the thermocouple type for a channel.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc134.tc_type_read" title="daqhats.mcc134.tc_type_read"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc134.tc_type_read()</span></code></a></td>
<td>Read the thermocouple type for a channel.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc134.update_interval_write" title="daqhats.mcc134.update_interval_write"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc134.update_interval_write()</span></code></a></td>
<td>Write the temperature update interval.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc134.update_interval_read" title="daqhats.mcc134.update_interval_read"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc134.update_interval_read()</span></code></a></td>
<td>Read the temperature update interval.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc134.t_in_read" title="daqhats.mcc134.t_in_read"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc134.t_in_read()</span></code></a></td>
<td>Read a temperature input channel.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc134.a_in_read" title="daqhats.mcc134.a_in_read"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc134.a_in_read()</span></code></a></td>
<td>Read an analog input channel.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc134.cjc_read" title="daqhats.mcc134.cjc_read"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc134.cjc_read()</span></code></a></td>
<td>Read a CJC temperature</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc134.address" title="daqhats.mcc134.address"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc134.address()</span></code></a></td>
<td>Read the board’s address.</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="daqhats.mcc134.OPEN_TC_VALUE">
<code class="descname">OPEN_TC_VALUE</code><em class="property"> = -9999.0</em><a class="headerlink" href="#daqhats.mcc134.OPEN_TC_VALUE" title="Permalink to this definition">¶</a></dt>
<dd><p>Return value for an open thermocouple.</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.mcc134.OVERRANGE_TC_VALUE">
<code class="descname">OVERRANGE_TC_VALUE</code><em class="property"> = -8888.0</em><a class="headerlink" href="#daqhats.mcc134.OVERRANGE_TC_VALUE" title="Permalink to this definition">¶</a></dt>
<dd><p>Return value for thermocouple voltage outside the valid range.</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.mcc134.COMMON_MODE_TC_VALUE">
<code class="descname">COMMON_MODE_TC_VALUE</code><em class="property"> = -7777.0</em><a class="headerlink" href="#daqhats.mcc134.COMMON_MODE_TC_VALUE" title="Permalink to this definition">¶</a></dt>
<dd><p>Return value for thermocouple input outside the common-mode range.</p>
</dd></dl>

<dl class="staticmethod">
<dt id="daqhats.mcc134.info">
<em class="property">static </em><code class="descname">info</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc134.info" title="Permalink to this definition">¶</a></dt>
<dd><p>Return constant information about this type of device.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">a namedtuple containing the following field names<ul class="simple">
<li><strong>NUM_AI_CHANNELS</strong> (int): The number of analog input channels
(4.)</li>
<li><strong>AI_MIN_CODE</strong> (int): The minimum ADC code (-8,388,608.)</li>
<li><strong>AI_MAX_CODE</strong> (int): The maximum ADC code (8,388,607.)</li>
<li><strong>AI_MIN_VOLTAGE</strong> (float): The voltage corresponding to the
minimum ADC code (-0.078125.)</li>
<li><strong>AI_MAX_VOLTAGE</strong> (float): The voltage corresponding to the
maximum ADC code (+0.078125 - 1 LSB)</li>
<li><strong>AI_MIN_RANGE</strong> (float): The minimum voltage of the input range
(-0.078125.)</li>
<li><strong>AI_MAX_RANGE</strong> (float): The maximum voltage of the input range
(+0.078125.)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">namedtuple</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc134.serial">
<code class="descname">serial</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc134.serial" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the serial number.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The serial number.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc134.calibration_date">
<code class="descname">calibration_date</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc134.calibration_date" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the calibration date.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The calibration date in the format “YYYY-MM-DD”.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc134.calibration_coefficient_read">
<code class="descname">calibration_coefficient_read</code><span class="sig-paren">(</span><em>channel</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc134.calibration_coefficient_read" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the calibration coefficients for a single channel.</p>
<p>The coefficients are applied in the library as:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">calibrated_ADC_code</span> <span class="o">=</span> <span class="p">(</span><span class="n">raw_ADC_code</span> <span class="o">*</span> <span class="n">slope</span><span class="p">)</span> <span class="o">+</span> <span class="n">offset</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">a namedtuple containing the following field names<ul class="simple">
<li><strong>slope</strong> (float): The slope.</li>
<li><strong>offset</strong> (float): The offset.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">namedtuple</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc134.calibration_coefficient_write">
<code class="descname">calibration_coefficient_write</code><span class="sig-paren">(</span><em>channel</em>, <em>slope</em>, <em>offset</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc134.calibration_coefficient_write" title="Permalink to this definition">¶</a></dt>
<dd><p>Temporarily write the calibration coefficients for a single channel.</p>
<p>The user can apply their own calibration coefficients by writing to
these values. The values will reset to the factory values from the
EEPROM whenever the class is initialized.</p>
<p>The coefficients are applied in the library as:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">calibrated_ADC_code</span> <span class="o">=</span> <span class="p">(</span><span class="n">raw_ADC_code</span> <span class="o">*</span> <span class="n">slope</span><span class="p">)</span> <span class="o">+</span> <span class="n">offset</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>slope</strong> (<em>float</em>) – The new slope value.</li>
<li><strong>offset</strong> (<em>float</em>) – The new offset value.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc134.tc_type_write">
<code class="descname">tc_type_write</code><span class="sig-paren">(</span><em>channel</em>, <em>tc_type</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc134.tc_type_write" title="Permalink to this definition">¶</a></dt>
<dd><p>Write the thermocouple type for a channel.</p>
<p>Enables a channel and tells the library what thermocouple type is
connected to the channel. This is needed for correct temperature
calculations. The type is one of <a class="reference internal" href="#daqhats.TcTypes" title="daqhats.TcTypes"><code class="xref py py-class docutils literal notranslate"><span class="pre">TcTypes</span></code></a> and the board will
default to all channels disabled (set to <a class="reference internal" href="#daqhats.TcTypes.DISABLED" title="daqhats.TcTypes.DISABLED"><code class="xref py py-const docutils literal notranslate"><span class="pre">TcTypes.DISABLED</span></code></a>)
when it is first opened.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>channel</strong> (<em>int</em>) – The analog input channel number, 0-3.</li>
<li><strong>tc_type</strong> (<a class="reference internal" href="#daqhats.TcTypes" title="daqhats.TcTypes"><code class="xref py py-class docutils literal notranslate"><span class="pre">TcTypes</span></code></a>) – The thermocouple type.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc134.tc_type_read">
<code class="descname">tc_type_read</code><span class="sig-paren">(</span><em>channel</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc134.tc_type_read" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the thermocouple type for a channel.</p>
<p>Reads the current thermocouple type for the specified channel. The type
is one of <a class="reference internal" href="#daqhats.TcTypes" title="daqhats.TcTypes"><code class="xref py py-class docutils literal notranslate"><span class="pre">TcTypes</span></code></a> and the board will default to all channels
disable (set to <a class="reference internal" href="#daqhats.TcTypes.DISABLED" title="daqhats.TcTypes.DISABLED"><code class="xref py py-const docutils literal notranslate"><span class="pre">TcTypes.DISABLED</span></code></a>) when it is first opened.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>channel</strong> (<em>int</em>) – The analog input channel number, 0-3.</td>
</tr>
</tbody>
</table>
<dl class="docutils">
<dt>Returns</dt>
<dd>int: The thermocouple type.</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc134.update_interval_write">
<code class="descname">update_interval_write</code><span class="sig-paren">(</span><em>interval</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc134.update_interval_write" title="Permalink to this definition">¶</a></dt>
<dd><p>Write the temperature update interval.</p>
<p>Tells the MCC 134 library how often to update temperatures, with the
interval specified in seconds.  The library defaults to updating every
second, but you may increase this interval if you do not plan to call
<a class="reference internal" href="#daqhats.mcc134.t_in_read" title="daqhats.mcc134.t_in_read"><code class="xref py py-func docutils literal notranslate"><span class="pre">t_in_read()</span></code></a> very often. This will reduce the load on shared
resources for other DAQ HATs.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>interval</strong> (<em>int</em>) – The interval in seconds, 1 - 255.</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc134.update_interval_read">
<code class="descname">update_interval_read</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc134.update_interval_read" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the temperature update interval.</p>
<p>Reads the library temperature update rate in seconds.</p>
<dl class="docutils">
<dt>Returns</dt>
<dd>int: The update interval.</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc134.t_in_read">
<code class="descname">t_in_read</code><span class="sig-paren">(</span><em>channel</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc134.t_in_read" title="Permalink to this definition">¶</a></dt>
<dd><p>Read a thermocouple input channel temperature.</p>
<p>The channel must be enabled with <a class="reference internal" href="#daqhats.mcc134.tc_type_write" title="daqhats.mcc134.tc_type_write"><code class="xref py py-func docutils literal notranslate"><span class="pre">tc_type_write()</span></code></a> or the
method will raise a ValueError exception.</p>
<p>This method returns immediately with the most recent temperature reading
for the specified channel. When a board is open, the library will read
each channel approximately once per second. There will be a delay when
the board is first opened because the read thread has to read the cold
junction compensation sensors and thermocouple inputs before it can
return the first value.</p>
<p>The method returns the value as degrees Celsius. The temperature value
can have some special values for abnormal conditions:</p>
<blockquote>
<div><ul class="simple">
<li><a class="reference internal" href="#daqhats.mcc134.OPEN_TC_VALUE" title="daqhats.mcc134.OPEN_TC_VALUE"><code class="xref py py-const docutils literal notranslate"><span class="pre">mcc134.OPEN_TC_VALUE</span></code></a> if an open thermocouple is
detected.</li>
<li><a class="reference internal" href="#daqhats.mcc134.OVERRANGE_TC_VALUE" title="daqhats.mcc134.OVERRANGE_TC_VALUE"><code class="xref py py-const docutils literal notranslate"><span class="pre">mcc134.OVERRANGE_TC_VALUE</span></code></a> if a value outside valid
thermocouple voltage is detected.</li>
<li><a class="reference internal" href="#daqhats.mcc134.COMMON_MODE_TC_VALUE" title="daqhats.mcc134.COMMON_MODE_TC_VALUE"><code class="xref py py-const docutils literal notranslate"><span class="pre">mcc134.COMMON_MODE_TC_VALUE</span></code></a> if a common-mode voltage
error is detected. This occurs when thermocouples on the same MCC
134 are at different voltages.</li>
</ul>
</div></blockquote>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>channel</strong> (<em>int</em>) – The analog input channel number, 0-3.</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The thermocouple temperature.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">float</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – the channel number is invalid or the channel is
disabled.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc134.a_in_read">
<code class="descname">a_in_read</code><span class="sig-paren">(</span><em>channel</em>, <em>options=&lt;OptionFlags.DEFAULT: 0&gt;</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc134.a_in_read" title="Permalink to this definition">¶</a></dt>
<dd><p>Read an analog input channel and return the value.</p>
<p>The channel must be enabled with <a class="reference internal" href="#daqhats.mcc134.tc_type_write" title="daqhats.mcc134.tc_type_write"><code class="xref py py-func docutils literal notranslate"><span class="pre">tc_type_write()</span></code></a> or the
method will raise a ValueError exception.</p>
<p>The returned voltage can have a special value to indicate abnormal
conditions:</p>
<ul class="simple">
<li><a class="reference internal" href="#daqhats.mcc134.COMMON_MODE_TC_VALUE" title="daqhats.mcc134.COMMON_MODE_TC_VALUE"><code class="xref py py-const docutils literal notranslate"><span class="pre">mcc134.COMMON_MODE_TC_VALUE</span></code></a> if a common-mode voltage
error is detected. This occurs when thermocouples on the same MCC
134 are at different voltages.</li>
</ul>
<p><strong>options</strong> is an ORed combination of OptionFlags. Valid flags for this
method are:</p>
<ul class="simple">
<li><a class="reference internal" href="#daqhats.OptionFlags.DEFAULT" title="daqhats.OptionFlags.DEFAULT"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.DEFAULT</span></code></a>: Return a calibrated voltage value.
Any other flags will override DEFAULT behavior.</li>
<li><a class="reference internal" href="#daqhats.OptionFlags.NOSCALEDATA" title="daqhats.OptionFlags.NOSCALEDATA"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.NOSCALEDATA</span></code></a>: Return an ADC code (a value
between -8,388,608 and 8,388,607) rather than voltage.</li>
<li><a class="reference internal" href="#daqhats.OptionFlags.NOCALIBRATEDATA" title="daqhats.OptionFlags.NOCALIBRATEDATA"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.NOCALIBRATEDATA</span></code></a>: Return data without the
calibration factors applied.</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>channel</strong> (<em>int</em>) – The analog input channel number, 0-3.</li>
<li><strong>options</strong> (<em>int</em>) – ORed combination of <a class="reference internal" href="#daqhats.OptionFlags" title="daqhats.OptionFlags"><code class="xref py py-class docutils literal notranslate"><span class="pre">OptionFlags</span></code></a>,
<a class="reference internal" href="#daqhats.OptionFlags.DEFAULT" title="daqhats.OptionFlags.DEFAULT"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.DEFAULT</span></code></a> if unspecified.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the read value</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">float</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – the channel number is invalid.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc134.cjc_read">
<code class="descname">cjc_read</code><span class="sig-paren">(</span><em>channel</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc134.cjc_read" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the cold junction compensation temperature for a specified channel.</p>
<p>Reads the cold junction sensor temperature for the specified
thermocouple terminal. The library automatically performs cold junction
compensation, so this function is only needed for informational use or
if you want to perform your own compensation. The temperature is
returned in degress C.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>channel</strong> (<em>int</em>) – The analog input channel number, 0-3.</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the read value</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">float</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – the channel number is invalid.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc134.address">
<code class="descname">address</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc134.address" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the device address.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="id3">
<h3>Data<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h3>
<div class="section" id="thermocouple-types">
<h4>Thermocouple types<a class="headerlink" href="#thermocouple-types" title="Permalink to this headline">¶</a></h4>
<dl class="class">
<dt id="daqhats.TcTypes">
<em class="property">class </em><code class="descclassname">daqhats.</code><code class="descname">TcTypes</code><a class="headerlink" href="#daqhats.TcTypes" title="Permalink to this definition">¶</a></dt>
<dd><p>Thermocouple types.</p>
<dl class="attribute">
<dt id="daqhats.TcTypes.TYPE_J">
<code class="descname">TYPE_J</code><em class="property"> = 0</em><a class="headerlink" href="#daqhats.TcTypes.TYPE_J" title="Permalink to this definition">¶</a></dt>
<dd><p>Type J</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.TcTypes.TYPE_K">
<code class="descname">TYPE_K</code><em class="property"> = 1</em><a class="headerlink" href="#daqhats.TcTypes.TYPE_K" title="Permalink to this definition">¶</a></dt>
<dd><p>Type K</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.TcTypes.TYPE_T">
<code class="descname">TYPE_T</code><em class="property"> = 2</em><a class="headerlink" href="#daqhats.TcTypes.TYPE_T" title="Permalink to this definition">¶</a></dt>
<dd><p>Type T</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.TcTypes.TYPE_E">
<code class="descname">TYPE_E</code><em class="property"> = 3</em><a class="headerlink" href="#daqhats.TcTypes.TYPE_E" title="Permalink to this definition">¶</a></dt>
<dd><p>Type E</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.TcTypes.TYPE_R">
<code class="descname">TYPE_R</code><em class="property"> = 4</em><a class="headerlink" href="#daqhats.TcTypes.TYPE_R" title="Permalink to this definition">¶</a></dt>
<dd><p>Type R</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.TcTypes.TYPE_S">
<code class="descname">TYPE_S</code><em class="property"> = 5</em><a class="headerlink" href="#daqhats.TcTypes.TYPE_S" title="Permalink to this definition">¶</a></dt>
<dd><p>Type S</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.TcTypes.TYPE_B">
<code class="descname">TYPE_B</code><em class="property"> = 6</em><a class="headerlink" href="#daqhats.TcTypes.TYPE_B" title="Permalink to this definition">¶</a></dt>
<dd><p>Type B</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.TcTypes.TYPE_N">
<code class="descname">TYPE_N</code><em class="property"> = 7</em><a class="headerlink" href="#daqhats.TcTypes.TYPE_N" title="Permalink to this definition">¶</a></dt>
<dd><p>Type N</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.TcTypes.DISABLED">
<code class="descname">DISABLED</code><em class="property"> = 255</em><a class="headerlink" href="#daqhats.TcTypes.DISABLED" title="Permalink to this definition">¶</a></dt>
<dd><p>Disabled</p>
</dd></dl>

</dd></dl>

</div>
</div>
</div>
<div class="section" id="mcc-152-class">
<h2>MCC 152 class<a class="headerlink" href="#mcc-152-class" title="Permalink to this headline">¶</a></h2>
<div class="section" id="id4">
<h3>Methods<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h3>
<dl class="class">
<dt id="daqhats.mcc152">
<em class="property">class </em><code class="descclassname">daqhats.</code><code class="descname">mcc152</code><span class="sig-paren">(</span><em>address=0</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152" title="Permalink to this definition">¶</a></dt>
<dd><p>The class for an MCC 152 board.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>address</strong> (<em>int</em>) – board address, must be 0-7.</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board did not respond or was of an incorrect type</td>
</tr>
</tbody>
</table>
<p class="rubric">Methods</p>
<table border="1" class="docutils">
<colgroup>
<col width="37%" />
<col width="63%" />
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td>Method</td>
<td>Description</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc152.info" title="daqhats.mcc152.info"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.info()</span></code></a></td>
<td>Get info about this device type.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc152.serial" title="daqhats.mcc152.serial"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.serial()</span></code></a></td>
<td>Read the serial number.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc152.a_out_write" title="daqhats.mcc152.a_out_write"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.a_out_write()</span></code></a></td>
<td>Write an analog output channel.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc152.a_out_write_all" title="daqhats.mcc152.a_out_write_all"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.a_out_write_all()</span></code></a></td>
<td>Write all analog output channels.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc152.dio_reset" title="daqhats.mcc152.dio_reset"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_reset()</span></code></a></td>
<td>Reset the digital I/O to the default configuration.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc152.dio_input_read_bit" title="daqhats.mcc152.dio_input_read_bit"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_input_read_bit()</span></code></a></td>
<td>Read a digital input.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc152.dio_input_read_port" title="daqhats.mcc152.dio_input_read_port"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_input_read_port()</span></code></a></td>
<td>Read all digital inputs.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc152.dio_input_read_tuple" title="daqhats.mcc152.dio_input_read_tuple"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_input_read_tuple()</span></code></a></td>
<td>Read all digital inputs as a tuple.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc152.dio_output_write_bit" title="daqhats.mcc152.dio_output_write_bit"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_output_write_bit()</span></code></a></td>
<td>Write a digital output.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc152.dio_output_write_port" title="daqhats.mcc152.dio_output_write_port"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_output_write_port()</span></code></a></td>
<td>Write all digital outputs.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc152.dio_output_write_dict" title="daqhats.mcc152.dio_output_write_dict"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_output_write_dict()</span></code></a></td>
<td>Write multiple digital outputs with a dictionary.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc152.dio_output_read_bit" title="daqhats.mcc152.dio_output_read_bit"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_output_read_bit()</span></code></a></td>
<td>Read the state of a digital output.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc152.dio_output_read_port" title="daqhats.mcc152.dio_output_read_port"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_output_read_port()</span></code></a></td>
<td>Read the state of all digital outputs.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc152.dio_output_read_tuple" title="daqhats.mcc152.dio_output_read_tuple"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_output_read_tuple()</span></code></a></td>
<td>Read the state of all digital outputs as a tuple.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc152.dio_int_status_read_bit" title="daqhats.mcc152.dio_int_status_read_bit"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_int_status_read_bit()</span></code></a></td>
<td>Read the interrupt status for a single channel.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc152.dio_int_status_read_port" title="daqhats.mcc152.dio_int_status_read_port"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_int_status_read_port()</span></code></a></td>
<td>Read the interrupt status for all channels.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc152.dio_int_status_read_tuple" title="daqhats.mcc152.dio_int_status_read_tuple"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_int_status_read_tuple()</span></code></a></td>
<td>Read the interrupt status for all channels as a tuple.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc152.dio_config_write_bit" title="daqhats.mcc152.dio_config_write_bit"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_config_write_bit()</span></code></a></td>
<td>Write a digital I/O configuration item value for a single channel.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc152.dio_config_write_port" title="daqhats.mcc152.dio_config_write_port"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_config_write_port()</span></code></a></td>
<td>Write a digital I/O configuration item value for all channels.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc152.dio_config_write_dict" title="daqhats.mcc152.dio_config_write_dict"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_config_write_dict()</span></code></a></td>
<td>Write a digital I/O configuration item value for multiple channels.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc152.dio_config_read_bit" title="daqhats.mcc152.dio_config_read_bit"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_config_read_bit()</span></code></a></td>
<td>Read a digital I/O configuration item value for a single channel.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc152.dio_config_read_port" title="daqhats.mcc152.dio_config_read_port"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_config_read_port()</span></code></a></td>
<td>Read a digital I/O configuration item value for all channels.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#daqhats.mcc152.dio_config_read_tuple" title="daqhats.mcc152.dio_config_read_tuple"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.dio_config_read_tuple()</span></code></a></td>
<td>Read a digital I/O configuration item value for all channels as a tuple.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#daqhats.mcc152.address" title="daqhats.mcc152.address"><code class="xref py py-func docutils literal notranslate"><span class="pre">mcc152.address()</span></code></a></td>
<td>Read the board’s address.</td>
</tr>
</tbody>
</table>
<dl class="staticmethod">
<dt id="daqhats.mcc152.info">
<em class="property">static </em><code class="descname">info</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.info" title="Permalink to this definition">¶</a></dt>
<dd><p>Return constant information about this type of device.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">a namedtuple containing the following field names<ul class="simple">
<li><strong>NUM_DIO_CHANNELS</strong> (int): The number of digital I/O channels
(8.)</li>
<li><strong>NUM_AO_CHANNELS</strong> (int): The number of analog output channels
(2.)</li>
<li><strong>AO_MIN_CODE</strong> (int): The minimum DAC code (0.)</li>
<li><strong>AO_MAX_CODE</strong> (int): The maximum DAC code (4095.)</li>
<li><strong>AO_MIN_VOLTAGE</strong> (float): The voltage corresponding to the
minimum DAC code (0.0.)</li>
<li><strong>AO_MAX_VOLTAGE</strong> (float): The voltage corresponding to the
maximum DAC code (+5.0 - 1 LSB)</li>
<li><strong>AO_MIN_RANGE</strong> (float): The minimum voltage of the output range
(0.0.)</li>
<li><strong>AO_MAX_RANGE</strong> (float): The maximum voltage of the output range
(+5.0.)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">namedtuple</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.serial">
<code class="descname">serial</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.serial" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the serial number.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">The serial number.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">string</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.a_out_write">
<code class="descname">a_out_write</code><span class="sig-paren">(</span><em>channel</em>, <em>value</em>, <em>options=&lt;OptionFlags.DEFAULT: 0&gt;</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.a_out_write" title="Permalink to this definition">¶</a></dt>
<dd><p>Write a single analog output channel value. The value will be limited to
the range of the DAC without raising an exception.</p>
<p><strong>options</strong> is an OptionFlags value. Valid flags for this
method are:</p>
<ul class="simple">
<li><a class="reference internal" href="#daqhats.OptionFlags.DEFAULT" title="daqhats.OptionFlags.DEFAULT"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.DEFAULT</span></code></a>: Write a voltage value (0 - 5).</li>
<li><a class="reference internal" href="#daqhats.OptionFlags.NOSCALEDATA" title="daqhats.OptionFlags.NOSCALEDATA"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.NOSCALEDATA</span></code></a>: Write a DAC code (a value
between 0 and 4095) rather than voltage.</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>channel</strong> (<em>int</em>) – The analog output channel number, 0-1.</li>
<li><strong>value</strong> (<em>float</em>) – The value to write.</li>
<li><strong>options</strong> (<em>int</em>) – An <a class="reference internal" href="#daqhats.OptionFlags" title="daqhats.OptionFlags"><code class="xref py py-class docutils literal notranslate"><span class="pre">OptionFlags</span></code></a> value,
<a class="reference internal" href="#daqhats.OptionFlags.DEFAULT" title="daqhats.OptionFlags.DEFAULT"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.DEFAULT</span></code></a> if unspecified.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – an argument is invalid.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.a_out_write_all">
<code class="descname">a_out_write_all</code><span class="sig-paren">(</span><em>values</em>, <em>options=&lt;OptionFlags.DEFAULT: 0&gt;</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.a_out_write_all" title="Permalink to this definition">¶</a></dt>
<dd><p>Write all analog output channels simultaneously.</p>
<p><strong>options</strong> is an OptionFlags value. Valid flags for this
method are:</p>
<ul class="simple">
<li><a class="reference internal" href="#daqhats.OptionFlags.DEFAULT" title="daqhats.OptionFlags.DEFAULT"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.DEFAULT</span></code></a>: Write voltage values (0 - 5).</li>
<li><a class="reference internal" href="#daqhats.OptionFlags.NOSCALEDATA" title="daqhats.OptionFlags.NOSCALEDATA"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.NOSCALEDATA</span></code></a>: Write DAC codes (values
between 0 and 4095) rather than voltage.</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>values</strong> (<em>list of float</em>) – The values to write, in channel order. There
must be at least two values, but only the first two will be
used.</li>
<li><strong>options</strong> (<em>int</em>) – An <a class="reference internal" href="#daqhats.OptionFlags" title="daqhats.OptionFlags"><code class="xref py py-class docutils literal notranslate"><span class="pre">OptionFlags</span></code></a> value,
<a class="reference internal" href="#daqhats.OptionFlags.DEFAULT" title="daqhats.OptionFlags.DEFAULT"><code class="xref py py-const docutils literal notranslate"><span class="pre">OptionFlags.DEFAULT</span></code></a> if unspecified.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – an argument is invalid.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_reset">
<code class="descname">dio_reset</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_reset" title="Permalink to this definition">¶</a></dt>
<dd><p>Reset the DIO to the default configuration.</p>
<ul class="simple">
<li>All channels input</li>
<li>Output registers set to 1</li>
<li>Input inversion disabled</li>
<li>No input latching</li>
<li>Pull-up resistors enabled</li>
<li>All interrupts disabled</li>
<li>Push-pull output type</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_input_read_bit">
<code class="descname">dio_input_read_bit</code><span class="sig-paren">(</span><em>channel</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_input_read_bit" title="Permalink to this definition">¶</a></dt>
<dd><p>Read a single digital input channel.</p>
<p>Returns 0 if the input is low, 1 if it is high.</p>
<p>If the specified channel is configured as an output this will return the
value present at the terminal.</p>
<p>This method reads the entire input register even though a single channel
is specified, so care must be taken when latched inputs are enabled. If
a latched input changes between input reads then changes back to its
original value, the next input read will report the change to the first
value then the following read will show the original value. If another
input is read then this input change could be missed so it is best to
use <a class="reference internal" href="#daqhats.mcc152.dio_input_read_port" title="daqhats.mcc152.dio_input_read_port"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_input_read_port()</span></code></a> or <a class="reference internal" href="#daqhats.mcc152.dio_input_read_tuple" title="daqhats.mcc152.dio_input_read_tuple"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_input_read_tuple()</span></code></a>
when using latched inputs.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>channel</strong> (<em>int</em>) – The DIO channel number, 0-7.</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The input value.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">int</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – an argument is invalid.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_input_read_port">
<code class="descname">dio_input_read_port</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_input_read_port" title="Permalink to this definition">¶</a></dt>
<dd><p>Read all digital input channels.</p>
<p>Returns the values as an integer with a value of 0 - 255. Each channel
is represented by a bit in the integer (bit 0 is channel 0, etc.)</p>
<p>The value of a specific input can be found by examining the bit at that
location. For example, to act on the channel 3 input:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">inputs</span> <span class="o">=</span> <span class="n">mcc152</span><span class="o">.</span><span class="n">dio_input_read_port</span><span class="p">()</span>
<span class="k">if</span> <span class="p">(</span><span class="n">inputs</span> <span class="o">&amp;</span> <span class="p">(</span><span class="mi">1</span> <span class="o">&lt;&lt;</span> <span class="mi">3</span><span class="p">))</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
    <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;channel 3 is 0&quot;</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
    <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;channel 3 is 1&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>If a channel is configured as an output this will return the value
present at the terminal.</p>
<p>Care must be taken when latched inputs are enabled. If a latched input
changes between input reads then changes back to its original value, the
next input read will report the change to the first value then the
following read will show the original value.</p>
<dl class="docutils">
<dt>Returns</dt>
<dd>int: The input values.</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_input_read_tuple">
<code class="descname">dio_input_read_tuple</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_input_read_tuple" title="Permalink to this definition">¶</a></dt>
<dd><p>Read all digital inputs at once as a tuple.</p>
<p>Returns a tuple of all input values in channel order. For example, to
compare the channel 1 input to the channel 3 input:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">inputs</span> <span class="o">=</span> <span class="n">mcc152</span><span class="o">.</span><span class="n">dio_input_read_tuple</span><span class="p">()</span>
<span class="k">if</span> <span class="n">inputs</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="n">inputs</span><span class="p">[</span><span class="mi">3</span><span class="p">]:</span>
    <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;channel 1 and channel 3 inputs are the same&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>If a channel is configured as an output this will return the value
present at the terminal.</p>
<p>Care must be taken when latched inputs are enabled. If a latched input
changes between input reads then changes back to its original value, the
next input read will report the change to the first value then the
following read will show the original value.</p>
<dl class="docutils">
<dt>Returns</dt>
<dd>tuple of int: The input values.</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_output_write_bit">
<code class="descname">dio_output_write_bit</code><span class="sig-paren">(</span><em>channel</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_output_write_bit" title="Permalink to this definition">¶</a></dt>
<dd><p>Write a single digital output channel.</p>
<p>If the specified channel is configured as an input this will not have
any effect at the terminal, but allows the output register to be loaded
before configuring the channel as an output.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>channel</strong> (<em>int</em>) – The digital channel number, 0-7.</li>
<li><strong>value</strong> (<em>int</em>) – The output value, 0 or 1.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – an argument is invalid.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_output_write_port">
<code class="descname">dio_output_write_port</code><span class="sig-paren">(</span><em>values</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_output_write_port" title="Permalink to this definition">¶</a></dt>
<dd><p>Write all digital output channel values.</p>
<p>Pass an integer in the range of 0 - 255, where each bit represents the
value of the associated channel (bit 0 is channel 0, etc.) If a
specified channel is configured as an input this will not have any
effect at the terminal, but allows the output register to be loaded
before configuring the channel as an output.</p>
<p>To change specific outputs without affecting other outputs first read
the output values with dio_output_read_port(), change the desired bits
in the result, then write them back.</p>
<p>For example, to set channels 0 and 2 to 1 without affecting the other
outputs:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">values</span> <span class="o">=</span> <span class="n">mcc152</span><span class="o">.</span><span class="n">dio_output_read_port</span><span class="p">()</span>
<span class="n">values</span> <span class="o">|=</span> <span class="mh">0x05</span>
<span class="n">mcc152</span><span class="o">.</span><span class="n">dio_output_write_port</span><span class="p">(</span><span class="n">values</span><span class="p">)</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>values</strong> (<em>integer</em>) – The output values.</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_output_write_dict">
<code class="descname">dio_output_write_dict</code><span class="sig-paren">(</span><em>value_dict</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_output_write_dict" title="Permalink to this definition">¶</a></dt>
<dd><p>Write multiple digital output channel values.</p>
<p>Pass a dictionary containing channel:value pairs. If a channel is
repeated in the dictionary then the last value will be used. If a
specified channel is configured as an input this will not have any
effect at the terminal, but allows the output register to be loaded
before configuring the channel as an output.</p>
<p>For example, to set channels 0 and 2 to 1 without affecting the other
outputs:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">values</span> <span class="o">=</span> <span class="p">{</span> <span class="mi">0</span><span class="p">:</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">:</span><span class="mi">1</span> <span class="p">}</span>
<span class="n">mcc152</span><span class="o">.</span><span class="n">dio_output_write_dict</span><span class="p">(</span><span class="n">values</span><span class="p">)</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>value_dict</strong> (<em>dictionary</em>) – The output values in a dictionary of
channel:value pairs.</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – an argument is invalid.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_output_read_bit">
<code class="descname">dio_output_read_bit</code><span class="sig-paren">(</span><em>channel</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_output_read_bit" title="Permalink to this definition">¶</a></dt>
<dd><p>Read a single digital output channel value.</p>
<p>This function returns the value stored in the output register. It may
not represent the value at the terminal if the channel is configured as
input or open-drain output.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>channel</strong> (<em>int</em>) – The digital channel number, 0-7.</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The output value.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first">int</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – an argument is invalid.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_output_read_port">
<code class="descname">dio_output_read_port</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_output_read_port" title="Permalink to this definition">¶</a></dt>
<dd><p>Read all digital output channel values.</p>
<p>Returns the values as an integer with a value of 0 - 255. Each channel
is represented by a bit in the integer (bit 0 is channel 0, etc.) The
value of a specific output can be found by examining the bit at that
location.</p>
<p>This function returns the values stored in the output register. They may
not represent the value at the terminal if the channel is configured as
input or open-drain output.</p>
<dl class="docutils">
<dt>Returns</dt>
<dd>int: The output values.</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_output_read_tuple">
<code class="descname">dio_output_read_tuple</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_output_read_tuple" title="Permalink to this definition">¶</a></dt>
<dd><p>Read all digital output channel values at once as a tuple.</p>
<p>Returns a tuple of all output values in channel order. For example, to
compare the channel 1 output to the channel 3 output:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">outputs</span> <span class="o">=</span> <span class="n">mcc152</span><span class="o">.</span><span class="n">dio_output_read_tuple</span><span class="p">()</span>
<span class="k">if</span> <span class="n">outputs</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="n">outputs</span><span class="p">[</span><span class="mi">3</span><span class="p">]:</span>
    <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;channel 1 and channel 3 outputs are the same&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>This function returns the values stored in the output register. They may
not represent the value at the terminal if the channel is configured as
input or open-drain output.</p>
<dl class="docutils">
<dt>Returns</dt>
<dd>tuple of int: The output values.</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_int_status_read_bit">
<code class="descname">dio_int_status_read_bit</code><span class="sig-paren">(</span><em>channel</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_int_status_read_bit" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the interrupt status for a single channel.</p>
<p>Returns 0 if the input is not generating an interrupt, 1 if it is
generating an interrupt.</p>
<dl class="docutils">
<dt>Returns</dt>
<dd>int: The interrupt status value.</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – an argument is invalid.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_int_status_read_port">
<code class="descname">dio_int_status_read_port</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_int_status_read_port" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the interrupt status for all channels.</p>
<p>Returns the values as an integer with a value of 0 - 255. Each channel
is represented by a bit in the integer (bit 0 is channel 0, etc.) The
status for a specific input can be found by examining the bit at that
location. Each bit will be 0 if the channel is not generating an
interrupt or 1 if it is generating an interrupt.</p>
<dl class="docutils">
<dt>Returns</dt>
<dd>int: The interrupt status values.</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_int_status_read_tuple">
<code class="descname">dio_int_status_read_tuple</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_int_status_read_tuple" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the interrupt status for all channels as a tuple.</p>
<p>Returns a tuple of all interrupt status values in channel order. Each
value will be 0 if the channel is not generating an interrupt or 1 if it
is generating an interrupt. For example, to see if an interrupt has
occurred on channel 2 or 4:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">status</span> <span class="o">=</span> <span class="n">mcc152</span><span class="o">.</span><span class="n">dio_int_status_read_tuple</span><span class="p">()</span>
<span class="k">if</span> <span class="n">status</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span> <span class="ow">or</span> <span class="n">status</span><span class="p">[</span><span class="mi">4</span><span class="p">]</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
    <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;an interrupt has occurred on channel 2 or 4&quot;</span><span class="p">)</span>
</pre></div>
</div>
<dl class="docutils">
<dt>Returns</dt>
<dd>tuple of int: The status values.</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_config_write_bit">
<code class="descname">dio_config_write_bit</code><span class="sig-paren">(</span><em>channel</em>, <em>item</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_config_write_bit" title="Permalink to this definition">¶</a></dt>
<dd><p>Write a digital I/O configuration value for a single channel.</p>
<p>There are several configuration items that may be written for the
digital I/O. The item is selected with the <strong>item</strong> argument, which may
be one of the <a class="reference internal" href="#daqhats.DIOConfigItem" title="daqhats.DIOConfigItem"><code class="xref py py-class docutils literal notranslate"><span class="pre">DIOConfigItem</span></code></a> values:</p>
<ul>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.DIRECTION" title="daqhats.DIOConfigItem.DIRECTION"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.DIRECTION</span></code></a>: Set the digital I/O channel
direction by passing 0 for output and 1 for input.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.PULL_CONFIG" title="daqhats.DIOConfigItem.PULL_CONFIG"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_CONFIG</span></code></a>: Configure the pull-up/down
resistor by passing 0 for pull-down or 1 for pull-up. The resistor may
be enabled or disabled with the <a class="reference internal" href="#daqhats.DIOConfigItem.PULL_ENABLE" title="daqhats.DIOConfigItem.PULL_ENABLE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_ENABLE</span></code></a>
item.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.PULL_ENABLE" title="daqhats.DIOConfigItem.PULL_ENABLE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_ENABLE</span></code></a>: Enable or disable the
pull-up/down resistor by passing 0 for disabled or 1 for enabled. The
resistor is configured for pull-up/down with the
<a class="reference internal" href="#daqhats.DIOConfigItem.PULL_CONFIG" title="daqhats.DIOConfigItem.PULL_CONFIG"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_CONFIG</span></code></a> item. The resistor is
automatically disabled if the bit is set to output and is configured
as open-drain.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.INPUT_INVERT" title="daqhats.DIOConfigItem.INPUT_INVERT"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INPUT_INVERT</span></code></a>: Enable inverting the input by
passing a 0 for normal input or 1 for inverted.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.INPUT_LATCH" title="daqhats.DIOConfigItem.INPUT_LATCH"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INPUT_LATCH</span></code></a>: Enable input latching by
passing 0 for non-latched or 1 for latched.</p>
<p>When the input is non-latched, reads show the current status of the
input. A state change in the input generates an interrupt (if it is
not masked). A read of the input clears the interrupt. If the input
goes back to its initial logic state before the input is read, then
the interrupt is cleared.</p>
<p>When the input is latched, a change of state of the input generates an
interrupt and the input logic value is loaded into the input port
register. A read of the input will clear the interrupt. If the input
returns to its initial logic state before the input is read, then the
interrupt is not cleared and the input register keeps the logic value
that initiated the interrupt. The next read of the input will show the
initial state. Care must be taken when using bit reads on the input
when latching is enabled - the bit method still reads the entire input
register so a change on another bit could be missed. It is best to use
port or tuple input reads when using latching.</p>
<p>If the input is changed from latched to non-latched, a read from the
input reflects the current terminal logic level. If the input is
changed from non-latched to latched input, the read from the input
represents the latched logic level.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.OUTPUT_TYPE" title="daqhats.DIOConfigItem.OUTPUT_TYPE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.OUTPUT_TYPE</span></code></a>: Set the output type by writing
0 for push-pull or 1 for open-drain. This setting affects all outputs
so is not a per-channel setting and the channel argument is ignored.
It should be set to the desired type before using
<a class="reference internal" href="#daqhats.DIOConfigItem.DIRECTION" title="daqhats.DIOConfigItem.DIRECTION"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.DIRECTION</span></code></a> item to set channels as outputs.
Internal pull-up/down resistors are disabled when a bit is set to
output and is configured as open-drain, so external resistors should
be used.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.INT_MASK" title="daqhats.DIOConfigItem.INT_MASK"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INT_MASK</span></code></a>: Enable or disable interrupt
generation by masking the interrupt. Write 0 to enable the interrupt
or 1 to mask (disable) it.</p>
<p>All MCC 152s share a single interrupt signal to the CPU, so when an
interrupt occurs the user must determine the source, optionally act
on the interrupt, then clear that source so that other interrupts
may be detected. The current interrupt state may be read with
<a class="reference internal" href="#daqhats.interrupt_state" title="daqhats.interrupt_state"><code class="xref py py-func docutils literal notranslate"><span class="pre">interrupt_state()</span></code></a>. A user program may wait for the interrupt
to become active with <a class="reference internal" href="#daqhats.wait_for_interrupt" title="daqhats.wait_for_interrupt"><code class="xref py py-func docutils literal notranslate"><span class="pre">wait_for_interrupt()</span></code></a>, or may register
an interrupt callback function with
<a class="reference internal" href="#daqhats.interrupt_callback_enable" title="daqhats.interrupt_callback_enable"><code class="xref py py-func docutils literal notranslate"><span class="pre">interrupt_callback_enable()</span></code></a>. This allows the user to wait for
a change on one or more inputs without constantly reading the inputs.
The source of the interrupt may be determined by reading the interrupt
status of each MCC 152 with <a class="reference internal" href="#daqhats.mcc152.dio_int_status_read_bit" title="daqhats.mcc152.dio_int_status_read_bit"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_int_status_read_bit()</span></code></a>,
<a class="reference internal" href="#daqhats.mcc152.dio_int_status_read_port" title="daqhats.mcc152.dio_int_status_read_port"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_int_status_read_port()</span></code></a> or
<a class="reference internal" href="#daqhats.mcc152.dio_int_status_read_tuple" title="daqhats.mcc152.dio_int_status_read_tuple"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_int_status_read_tuple()</span></code></a>, and all active interrupt
sources must be cleared before the interrupt will become inactive. The
interrupt is cleared by reading the input with
<a class="reference internal" href="#daqhats.mcc152.dio_input_read_bit" title="daqhats.mcc152.dio_input_read_bit"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_input_read_bit()</span></code></a>, <a class="reference internal" href="#daqhats.mcc152.dio_input_read_port" title="daqhats.mcc152.dio_input_read_port"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_input_read_port()</span></code></a>, or
<a class="reference internal" href="#daqhats.mcc152.dio_input_read_tuple" title="daqhats.mcc152.dio_input_read_tuple"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_input_read_tuple()</span></code></a>.</p>
</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>channel</strong> (<em>integer</em>) – The digital I/O channel, 0 - 7</li>
<li><strong>item</strong> (<em>integer</em>) – The configuration item, one of
<a class="reference internal" href="#daqhats.DIOConfigItem" title="daqhats.DIOConfigItem"><code class="xref py py-class docutils literal notranslate"><span class="pre">DIOConfigItem</span></code></a>.</li>
<li><strong>value</strong> (<em>integer</em>) – The configuration value.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – an argument is invalid.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_config_write_port">
<code class="descname">dio_config_write_port</code><span class="sig-paren">(</span><em>item</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_config_write_port" title="Permalink to this definition">¶</a></dt>
<dd><p>Write a digital I/O configuration value for all channels.</p>
<p>There are several configuration items that may be written for the
digital I/O. They are written for all channels at once using an 8-bit
value passed in <strong>value</strong>, where each bit corresponds to a channel (bit
0 is channel 0, etc.) The item is selected with the <strong>item</strong> argument,
which may be one of the <a class="reference internal" href="#daqhats.DIOConfigItem" title="daqhats.DIOConfigItem"><code class="xref py py-class docutils literal notranslate"><span class="pre">DIOConfigItem</span></code></a> values.</p>
<ul>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.DIRECTION" title="daqhats.DIOConfigItem.DIRECTION"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.DIRECTION</span></code></a>: Set the digital I/O channel
directions by passing 0 in a bit for output and 1 for input.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.PULL_CONFIG" title="daqhats.DIOConfigItem.PULL_CONFIG"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_CONFIG</span></code></a>: Configure the pull-up/down
resistors by passing 0 in a bit for pull-down or 1 for pull-up. The
resistors may be enabled or disabled with the
<a class="reference internal" href="#daqhats.DIOConfigItem.PULL_ENABLE" title="daqhats.DIOConfigItem.PULL_ENABLE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_ENABLE</span></code></a> item.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.PULL_ENABLE" title="daqhats.DIOConfigItem.PULL_ENABLE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_ENABLE</span></code></a>: Enable or disable pull-up/down
resistors by passing 0 in a bit for disabled or 1 for enabled. The
resistors are configured for pull-up/down with the
<a class="reference internal" href="#daqhats.DIOConfigItem.PULL_CONFIG" title="daqhats.DIOConfigItem.PULL_CONFIG"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_CONFIG</span></code></a> item. The resistors are
automatically disabled if the bits are set to output and configured as
open-drain.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.INPUT_INVERT" title="daqhats.DIOConfigItem.INPUT_INVERT"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INPUT_INVERT</span></code></a>: Enable inverting inputs by
passing a 0 in a bit for normal input or 1 for inverted.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.INPUT_LATCH" title="daqhats.DIOConfigItem.INPUT_LATCH"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INPUT_LATCH</span></code></a>: Enable input latching by
passing 0 in a bit for non-latched or 1 for latched.</p>
<p>When the input is non-latched, reads show the current status of the
input. A state change in the corresponding input generates an
interrupt (if it is not masked). A read of the input clears the
interrupt. If the input goes back to its initial logic state before
the input is read, then the interrupt is cleared. When the input is
latched, a change of state of the input generates an interrupt and the
input logic value is loaded into the input port register. A read of
the input will clear the interrupt. If the input returns to its
initial logic state before the input is read, then the interrupt is
not cleared and the input register keeps the logic value that
initiated the interrupt. The next read of the input will show the
initial state. Care must be taken when using bit reads on the input
when latching is enabled - the bit method still reads the entire input
register so a change on another bit could be missed. It is best to use
port or tuple input reads when using latching.</p>
<p>If the input is changed from latched to non-latched, a read from the
input reflects the current terminal logic level. If the input is
changed from non-latched to latched input, the read from the input
represents the latched logic level.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.OUTPUT_TYPE" title="daqhats.DIOConfigItem.OUTPUT_TYPE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.OUTPUT_TYPE</span></code></a>: Set the output type by writing
0 for push-pull or 1 for open-drain. This setting affects all outputs
so is not a per-channel setting. It should be set to the desired type
before using <a class="reference internal" href="#daqhats.DIOConfigItem.DIRECTION" title="daqhats.DIOConfigItem.DIRECTION"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.DIRECTION</span></code></a> to set channels as
outputs. Internal pull-up/down resistors are disabled when a bit is
set to output and is configured as open-drain, so external resistors
should be used.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.INT_MASK" title="daqhats.DIOConfigItem.INT_MASK"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INT_MASK</span></code></a>: Enable or disable interrupt
generation for specific inputs by masking the interrupt. Write 0 in a
bit to enable the interrupt from that channel or 1 to mask (disable)
it.</p>
<p>All MCC 152s share a single interrupt signal to the CPU, so when an
interrupt occurs the user must determine the source, optionally act
on the interrupt, then clear that source so that other interrupts
may be detected. The current interrupt state may be read with
<a class="reference internal" href="#daqhats.interrupt_state" title="daqhats.interrupt_state"><code class="xref py py-func docutils literal notranslate"><span class="pre">interrupt_state()</span></code></a>. A user program may wait for the interrupt
to become active with <a class="reference internal" href="#daqhats.wait_for_interrupt" title="daqhats.wait_for_interrupt"><code class="xref py py-func docutils literal notranslate"><span class="pre">wait_for_interrupt()</span></code></a>, or may register
an interrupt callback function with
<a class="reference internal" href="#daqhats.interrupt_callback_enable" title="daqhats.interrupt_callback_enable"><code class="xref py py-func docutils literal notranslate"><span class="pre">interrupt_callback_enable()</span></code></a>. This allows the user to wait for
a change on one or more inputs without constantly reading the inputs.
The source of the interrupt may be determined by reading the interrupt
status of each MCC 152 with <a class="reference internal" href="#daqhats.mcc152.dio_int_status_read_bit" title="daqhats.mcc152.dio_int_status_read_bit"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_int_status_read_bit()</span></code></a>,
<a class="reference internal" href="#daqhats.mcc152.dio_int_status_read_port" title="daqhats.mcc152.dio_int_status_read_port"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_int_status_read_port()</span></code></a> or
<a class="reference internal" href="#daqhats.mcc152.dio_int_status_read_tuple" title="daqhats.mcc152.dio_int_status_read_tuple"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_int_status_read_tuple()</span></code></a>, and all active interrupt
sources must be cleared before the interrupt will become inactive. The
interrupt is cleared by reading the input with
<a class="reference internal" href="#daqhats.mcc152.dio_input_read_bit" title="daqhats.mcc152.dio_input_read_bit"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_input_read_bit()</span></code></a>, <a class="reference internal" href="#daqhats.mcc152.dio_input_read_port" title="daqhats.mcc152.dio_input_read_port"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_input_read_port()</span></code></a>, or
<a class="reference internal" href="#daqhats.mcc152.dio_input_read_tuple" title="daqhats.mcc152.dio_input_read_tuple"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_input_read_tuple()</span></code></a>.</p>
</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>item</strong> (<em>integer</em>) – The configuration item, one of
<a class="reference internal" href="#daqhats.DIOConfigItem" title="daqhats.DIOConfigItem"><code class="xref py py-class docutils literal notranslate"><span class="pre">DIOConfigItem</span></code></a>.</li>
<li><strong>value</strong> (<em>integer</em>) – The configuration value.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – an argument is invalid.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_config_write_dict">
<code class="descname">dio_config_write_dict</code><span class="sig-paren">(</span><em>item</em>, <em>value_dict</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_config_write_dict" title="Permalink to this definition">¶</a></dt>
<dd><p>Write a digital I/O configuration value for multiple channels.</p>
<p>There are several configuration items that may be written for the
digital I/O. They are written for multiple channels at once using a
dictionary of channel:value pairs. If a channel is repeated in the
dictionary then the last value will be used. The item is selected with
the <strong>item</strong> argument, which may be one of the <a class="reference internal" href="#daqhats.DIOConfigItem" title="daqhats.DIOConfigItem"><code class="xref py py-class docutils literal notranslate"><span class="pre">DIOConfigItem</span></code></a>
values:</p>
<ul>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.DIRECTION" title="daqhats.DIOConfigItem.DIRECTION"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.DIRECTION</span></code></a>: Set the digital I/O channel
directions by passing 0 in a value for output and 1 for input.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.PULL_CONFIG" title="daqhats.DIOConfigItem.PULL_CONFIG"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_CONFIG</span></code></a>: Configure the pull-up/down
resistors by passing 0 in a value for pull-down or 1 for pull-up. The
resistors may be enabled or disabled with the
<a class="reference internal" href="#daqhats.DIOConfigItem.PULL_ENABLE" title="daqhats.DIOConfigItem.PULL_ENABLE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_ENABLE</span></code></a> item.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.PULL_ENABLE" title="daqhats.DIOConfigItem.PULL_ENABLE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_ENABLE</span></code></a>: Enable or disable pull-up/down
resistors by passing 0 in a value for disabled or 1 for enabled. The
resistors are configured for pull-up/down with the
<a class="reference internal" href="#daqhats.DIOConfigItem.PULL_CONFIG" title="daqhats.DIOConfigItem.PULL_CONFIG"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_CONFIG</span></code></a> item. The resistors are
automatically disabled if the bits are set to output and configured as
open-drain.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.INPUT_INVERT" title="daqhats.DIOConfigItem.INPUT_INVERT"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INPUT_INVERT</span></code></a>: Enable inverting inputs by
passing a 0 in a value for normal input or 1 for inverted.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.INPUT_LATCH" title="daqhats.DIOConfigItem.INPUT_LATCH"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INPUT_LATCH</span></code></a>: Enable input latching by
passing 0 in a value for non-latched or 1 for latched.</p>
<p>When the input is non-latched, reads show the current status of the
input. A state change in the corresponding input generates an
interrupt (if it is not masked). A read of the input clears the
interrupt. If the input goes back to its initial logic state before
the input is read, then the interrupt is cleared. When the input is
latched, a change of state of the input generates an interrupt and the
input logic value is loaded into the input port register. A read of
the input will clear the interrupt. If the input returns to its
initial logic state before the input is read, then the interrupt is
not cleared and the input register keeps the logic value that
initiated the interrupt. The next read of the input will show the
initial state. Care must be taken when using bit reads on the input
when latching is enabled - the bit method still reads the entire input
register so a change on another bit could be missed. It is best to use
port or tuple input reads when using latching.</p>
<p>If the input is changed from latched to non-latched, a read from the
input reflects the current terminal logic level. If the input is
changed from non-latched to latched input, the read from the input
represents the latched logic level.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.OUTPUT_TYPE" title="daqhats.DIOConfigItem.OUTPUT_TYPE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.OUTPUT_TYPE</span></code></a>: Set the output type by writing
0 for push-pull or 1 for open-drain. This setting affects all outputs
so is not a per-channel setting. It should be set to the desired type
before using <a class="reference internal" href="#daqhats.DIOConfigItem.DIRECTION" title="daqhats.DIOConfigItem.DIRECTION"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.DIRECTION</span></code></a> to set channels as
outputs. Internal pull-up/down resistors are disabled when a bit is
set to output and is configured as open-drain, so external resistors
should be used.</p>
</li>
<li><p class="first"><a class="reference internal" href="#daqhats.DIOConfigItem.INT_MASK" title="daqhats.DIOConfigItem.INT_MASK"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INT_MASK</span></code></a>: Enable or disable interrupt
generation for specific inputs by masking the interrupt. Write 0 in a
value to enable the interrupt from that channel or 1 to mask (disable)
it.</p>
<p>All MCC 152s share a single interrupt signal to the CPU, so when an
interrupt occurs the user must determine the source, optionally act
on the interrupt, then clear that source so that other interrupts
may be detected. The current interrupt state may be read with
<a class="reference internal" href="#daqhats.interrupt_state" title="daqhats.interrupt_state"><code class="xref py py-func docutils literal notranslate"><span class="pre">interrupt_state()</span></code></a>. A user program may wait for the interrupt
to become active with <a class="reference internal" href="#daqhats.wait_for_interrupt" title="daqhats.wait_for_interrupt"><code class="xref py py-func docutils literal notranslate"><span class="pre">wait_for_interrupt()</span></code></a>, or may register
an interrupt callback function with
<a class="reference internal" href="#daqhats.interrupt_callback_enable" title="daqhats.interrupt_callback_enable"><code class="xref py py-func docutils literal notranslate"><span class="pre">interrupt_callback_enable()</span></code></a>. This allows the user to wait for
a change on one or more inputs without constantly reading the inputs.
The source of the interrupt may be determined by reading the interrupt
status of each MCC 152 with <a class="reference internal" href="#daqhats.mcc152.dio_int_status_read_bit" title="daqhats.mcc152.dio_int_status_read_bit"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_int_status_read_bit()</span></code></a>,
<a class="reference internal" href="#daqhats.mcc152.dio_int_status_read_port" title="daqhats.mcc152.dio_int_status_read_port"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_int_status_read_port()</span></code></a> or
<a class="reference internal" href="#daqhats.mcc152.dio_int_status_read_tuple" title="daqhats.mcc152.dio_int_status_read_tuple"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_int_status_read_tuple()</span></code></a>, and all active interrupt
sources must be cleared before the interrupt will become inactive. The
interrupt is cleared by reading the input with
<a class="reference internal" href="#daqhats.mcc152.dio_input_read_bit" title="daqhats.mcc152.dio_input_read_bit"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_input_read_bit()</span></code></a>, <a class="reference internal" href="#daqhats.mcc152.dio_input_read_port" title="daqhats.mcc152.dio_input_read_port"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_input_read_port()</span></code></a>, or
<a class="reference internal" href="#daqhats.mcc152.dio_input_read_tuple" title="daqhats.mcc152.dio_input_read_tuple"><code class="xref py py-func docutils literal notranslate"><span class="pre">dio_input_read_tuple()</span></code></a>.</p>
</li>
</ul>
<p>For example, to set channels 6 and 7 to output:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">values</span> <span class="o">=</span> <span class="p">{</span> <span class="mi">6</span><span class="p">:</span><span class="mi">0</span><span class="p">,</span> <span class="mi">7</span><span class="p">:</span><span class="mi">0</span> <span class="p">}</span>
<span class="n">mcc152</span><span class="o">.</span><span class="n">dio_config_write_dict</span><span class="p">(</span><span class="n">DIOConfigItem</span><span class="o">.</span><span class="n">DIRECTION</span><span class="p">,</span> <span class="n">values</span><span class="p">)</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>item</strong> (<em>integer</em>) – The configuration item, one of
<a class="reference internal" href="#daqhats.DIOConfigItem" title="daqhats.DIOConfigItem"><code class="xref py py-class docutils literal notranslate"><span class="pre">DIOConfigItem</span></code></a>.</li>
<li><strong>value_dict</strong> (<em>dictionary</em>) – The configuration values for multiple
channels in a dictionary of channel:value pairs.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – an argument is invalid.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_config_read_bit">
<code class="descname">dio_config_read_bit</code><span class="sig-paren">(</span><em>channel</em>, <em>item</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_config_read_bit" title="Permalink to this definition">¶</a></dt>
<dd><p>Read a digital I/O configuration value for a single channel.</p>
<p>There are several configuration items that may be read for the digital
I/O. The item is selected with the <strong>item</strong> argument, which may be one
of the DIOConfigItems values:</p>
<ul class="simple">
<li><a class="reference internal" href="#daqhats.DIOConfigItem.DIRECTION" title="daqhats.DIOConfigItem.DIRECTION"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.DIRECTION</span></code></a>: Read the digital I/O channel
direction setting, where 0 is output and 1 is input.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.PULL_CONFIG" title="daqhats.DIOConfigItem.PULL_CONFIG"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_CONFIG</span></code></a>: Read the pull-up/down resistor
configuration where 0 is pull-down and 1 is pull-up.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.PULL_ENABLE" title="daqhats.DIOConfigItem.PULL_ENABLE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_ENABLE</span></code></a>: Read the pull-up/down resistor
enable setting where 0 is disabled and 1 is enabled.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.INPUT_INVERT" title="daqhats.DIOConfigItem.INPUT_INVERT"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INPUT_INVERT</span></code></a>: Read the input inversion
setting where 0 is normal input and 1 is inverted.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.INPUT_LATCH" title="daqhats.DIOConfigItem.INPUT_LATCH"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INPUT_LATCH</span></code></a>: Read the input latching setting
where 0 is non-latched and 1 is latched.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.OUTPUT_TYPE" title="daqhats.DIOConfigItem.OUTPUT_TYPE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.OUTPUT_TYPE</span></code></a>: Read the output type setting
where 0 is push-pull and 1 is open-drain. This setting affects all
outputs so is not a per-channel setting and the channel argument is
ignored.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.INT_MASK" title="daqhats.DIOConfigItem.INT_MASK"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INT_MASK</span></code></a>: Read the interrupt mask setting
where 0 in a bit enables the interrupt and 1 disables it.</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>channel</strong> (<em>integer</em>) – The digital I/O channel, 0 - 7.</li>
<li><strong>item</strong> (<em>integer</em>) – The configuration item, one of
<a class="reference internal" href="#daqhats.DIOConfigItem" title="daqhats.DIOConfigItem"><code class="xref py py-class docutils literal notranslate"><span class="pre">DIOConfigItem</span></code></a>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="docutils">
<dt>Returns</dt>
<dd>int: The configuration item value.</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – an argument is invalid.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_config_read_port">
<code class="descname">dio_config_read_port</code><span class="sig-paren">(</span><em>item</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_config_read_port" title="Permalink to this definition">¶</a></dt>
<dd><p>Read a digital I/O configuration value for all channels.</p>
<p>There are several configuration items that may be read for the digital
I/O. They are read for all channels at once, returning an 8-bit integer
where each bit corresponds to a channel (bit 0 is channel 0, etc.) The
item is selected with the <strong>item</strong> argument, which may be one of the
<a class="reference internal" href="#daqhats.DIOConfigItem" title="daqhats.DIOConfigItem"><code class="xref py py-class docutils literal notranslate"><span class="pre">DIOConfigItem</span></code></a> values:</p>
<ul class="simple">
<li><a class="reference internal" href="#daqhats.DIOConfigItem.DIRECTION" title="daqhats.DIOConfigItem.DIRECTION"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.DIRECTION</span></code></a>: Read the digital I/O channels
direction settings, where 0 in a bit is output and 1 is input.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.PULL_CONFIG" title="daqhats.DIOConfigItem.PULL_CONFIG"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_CONFIG</span></code></a>: Read the pull-up/down resistor
configurations where 0 in a bit is pull-down and 1 is pull-up.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.PULL_ENABLE" title="daqhats.DIOConfigItem.PULL_ENABLE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_ENABLE</span></code></a>: Read the pull-up/down resistor
enable settings where 0 in a bit is disabled and 1 is enabled.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.INPUT_INVERT" title="daqhats.DIOConfigItem.INPUT_INVERT"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INPUT_INVERT</span></code></a>: Read the input inversion
settings where 0 in a bit is normal input and 1 is inverted.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.INPUT_LATCH" title="daqhats.DIOConfigItem.INPUT_LATCH"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INPUT_LATCH</span></code></a>: Read the input latching
settings where 0 in a bit is non-latched and 1 is latched.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.OUTPUT_TYPE" title="daqhats.DIOConfigItem.OUTPUT_TYPE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.OUTPUT_TYPE</span></code></a>: Read the output type setting
where 0 is push-pull and 1 is open-drain. This setting affects all
outputs so is not a per-channel setting.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.INT_MASK" title="daqhats.DIOConfigItem.INT_MASK"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INT_MASK</span></code></a>: Read the interrupt mask settings
where 0 in a bit enables the interrupt and 1 disables it.</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>item</strong> (<em>integer</em>) – The configuration item, one of
<a class="reference internal" href="#daqhats.DIOConfigItem" title="daqhats.DIOConfigItem"><code class="xref py py-class docutils literal notranslate"><span class="pre">DIOConfigItem</span></code></a>.</td>
</tr>
</tbody>
</table>
<dl class="docutils">
<dt>Returns</dt>
<dd>int: The configuration item value.</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – an argument is invalid.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.dio_config_read_tuple">
<code class="descname">dio_config_read_tuple</code><span class="sig-paren">(</span><em>item</em><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.dio_config_read_tuple" title="Permalink to this definition">¶</a></dt>
<dd><p>Read a digital I/O configuration value for all channels as a tuple.</p>
<p>There are several configuration items that may be read for the digital
I/O. They are read for all channels at once, returning a tuple in
channel order. The item is selected with the <strong>item</strong> argument, which
may be one of the <a class="reference internal" href="#daqhats.DIOConfigItem" title="daqhats.DIOConfigItem"><code class="xref py py-class docutils literal notranslate"><span class="pre">DIOConfigItem</span></code></a> values:</p>
<ul class="simple">
<li><a class="reference internal" href="#daqhats.DIOConfigItem.DIRECTION" title="daqhats.DIOConfigItem.DIRECTION"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.DIRECTION</span></code></a>: Read the digital I/O channels
direction settings, where 0 in a value is output and 1 is input.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.PULL_CONFIG" title="daqhats.DIOConfigItem.PULL_CONFIG"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_CONFIG</span></code></a>: Read the pull-up/down resistor
configurations where 0 in a value is pull-down and 1 is pull-up.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.PULL_ENABLE" title="daqhats.DIOConfigItem.PULL_ENABLE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.PULL_ENABLE</span></code></a>: Read the pull-up/down resistor
enable settings where 0 in a value is disabled and 1 is enabled.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.INPUT_INVERT" title="daqhats.DIOConfigItem.INPUT_INVERT"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INPUT_INVERT</span></code></a>: Read the input inversion
settings where 0 in a value is normal input and 1 is inverted.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.INPUT_LATCH" title="daqhats.DIOConfigItem.INPUT_LATCH"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INPUT_LATCH</span></code></a>: Read the input latching
settings where 0 in a value is non-latched and 1 is latched.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.OUTPUT_TYPE" title="daqhats.DIOConfigItem.OUTPUT_TYPE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.OUTPUT_TYPE</span></code></a>: Read the output type setting
where 0 is push-pull and 1 is open-drain. This setting affects all
outputs so is not a per-channel setting.</li>
<li><a class="reference internal" href="#daqhats.DIOConfigItem.INT_MASK" title="daqhats.DIOConfigItem.INT_MASK"><code class="xref py py-const docutils literal notranslate"><span class="pre">DIOConfigItem.INT_MASK</span></code></a>: Read the interrupt mask settings
where 0 in a value enables the interrupt and 1 disables it.</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>item</strong> (<em>integer</em>) – The configuration item, one of
<a class="reference internal" href="#daqhats.DIOConfigItem" title="daqhats.DIOConfigItem"><code class="xref py py-class docutils literal notranslate"><span class="pre">DIOConfigItem</span></code></a>.</td>
</tr>
</tbody>
</table>
<dl class="docutils">
<dt>Returns</dt>
<dd>tuple of int: The configuration item values.</dd>
</dl>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
<li><a class="reference internal" href="#daqhats.HatError" title="daqhats.HatError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">HatError</span></code></a> – the board is not initialized, does not respond, or
responds incorrectly.</li>
<li><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code> – an argument is invalid.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="daqhats.mcc152.address">
<code class="descname">address</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#daqhats.mcc152.address" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the device address.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="id5">
<h3>Data<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h3>
<div class="section" id="dio-config-items">
<h4>DIO Config Items<a class="headerlink" href="#dio-config-items" title="Permalink to this headline">¶</a></h4>
<dl class="class">
<dt id="daqhats.DIOConfigItem">
<em class="property">class </em><code class="descclassname">daqhats.</code><code class="descname">DIOConfigItem</code><a class="headerlink" href="#daqhats.DIOConfigItem" title="Permalink to this definition">¶</a></dt>
<dd><p>Digital I/O Configuration Items.</p>
<dl class="attribute">
<dt id="daqhats.DIOConfigItem.DIRECTION">
<code class="descname">DIRECTION</code><em class="property"> = 0</em><a class="headerlink" href="#daqhats.DIOConfigItem.DIRECTION" title="Permalink to this definition">¶</a></dt>
<dd><p>Configure channel direction</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.DIOConfigItem.PULL_CONFIG">
<code class="descname">PULL_CONFIG</code><em class="property"> = 1</em><a class="headerlink" href="#daqhats.DIOConfigItem.PULL_CONFIG" title="Permalink to this definition">¶</a></dt>
<dd><p>Configure pull-up/down resistor</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.DIOConfigItem.PULL_ENABLE">
<code class="descname">PULL_ENABLE</code><em class="property"> = 2</em><a class="headerlink" href="#daqhats.DIOConfigItem.PULL_ENABLE" title="Permalink to this definition">¶</a></dt>
<dd><p>Enable pull-up/down resistor</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.DIOConfigItem.INPUT_INVERT">
<code class="descname">INPUT_INVERT</code><em class="property"> = 3</em><a class="headerlink" href="#daqhats.DIOConfigItem.INPUT_INVERT" title="Permalink to this definition">¶</a></dt>
<dd><p>Configure input inversion</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.DIOConfigItem.INPUT_LATCH">
<code class="descname">INPUT_LATCH</code><em class="property"> = 4</em><a class="headerlink" href="#daqhats.DIOConfigItem.INPUT_LATCH" title="Permalink to this definition">¶</a></dt>
<dd><p>Configure input latching</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.DIOConfigItem.OUTPUT_TYPE">
<code class="descname">OUTPUT_TYPE</code><em class="property"> = 5</em><a class="headerlink" href="#daqhats.DIOConfigItem.OUTPUT_TYPE" title="Permalink to this definition">¶</a></dt>
<dd><p>Configure output type</p>
</dd></dl>

<dl class="attribute">
<dt id="daqhats.DIOConfigItem.INT_MASK">
<code class="descname">INT_MASK</code><em class="property"> = 6</em><a class="headerlink" href="#daqhats.DIOConfigItem.INT_MASK" title="Permalink to this definition">¶</a></dt>
<dd><p>Configure interrupt mask</p>
</dd></dl>

</dd></dl>

</div>
</div>
</div>
</div>


           </div>
           
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
      
        <a href="c.html" class="btn btn-neutral" title="C Library Reference" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2019, Measurement Computing.

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'./',
            VERSION:'1.2.0',
            LANGUAGE:'None',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  true,
            SOURCELINK_SUFFIX: '.txt'
        };
    </script>
      <script type="text/javascript" src="_static/jquery.js"></script>
      <script type="text/javascript" src="_static/underscore.js"></script>
      <script type="text/javascript" src="_static/doctools.js"></script>

  

  
  
    <script type="text/javascript" src="_static/js/theme.js"></script>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>